Commit Graph

7408 Commits

Author SHA1 Message Date
Wunkolo 6ee2e3718f [x64] Add AVX512 optimizations for `OPCODE_VECTOR_COMPARE_UGT`(Integer)
AVX512 has native unsigned integer comparisons instructions, removing
the need to XOR the most-significant-bit with a constant in memory to
use the signed comparison instructions. These instructions only write to
a k-mask register though and need an additional call to `vpmovm2*` to
turn the mask-register into a vector-mask register.

As of Icelake:
`vpcmpu*` is all L3/T1
`vpmovm2d` is L1/T0.33
`vpmovm2{b,w}` is L3/T0.33

As of Zen4:
`vpcmpu*` is all L3/T0.50
`vpmovm2*` is all L1/T0.25
2023-05-29 14:57:09 -05:00
Wunkolo 121bf93cbe [PPC] Implement `vsubcuw`
Other half of #2125. I don't know of any title that utilizes this instruction, but I went ahead and implemented it for completeness.

Verified the implementation with `instr__gen_vsubcuw` from #1348. Can be grabbed with:
```
git checkout origin/gen_tests -- src\xenia\cpu\ppc\testing\*vsubcuw.s
```
2023-05-29 14:56:12 -05:00
Wunkolo 93b77fb775 [PPC] Implement `vaddcuw`
I don't know of any title that utilizes this instruction, but I went
ahead and implemented it for completeness.

Verified the implementation with `instr__gen_vaddcuw` from #1348. Can be
grabbed with:
```
git checkout origin/gen_tests -- src\xenia\cpu\ppc\testing\*vaddcuw.s
```
2023-05-29 14:56:00 -05:00
chrisps ad2d27f6dc
Merge pull request #162 from gmriggs/canary_experimental
fix array index out of bounds crash in EmulatorWindow::ProcessControllerHotkey
2023-05-20 09:55:43 -04:00
gmriggs 85a93029a7 fix array index out of bounds crash in EmulatorWindow::ProcessControllerHotkey 2023-05-19 15:26:19 -04:00
Triang3l ed64e3072b [GPU] Remove implicit bool cast in memexport checks 2023-05-05 21:38:45 +03:00
Triang3l 0e81293b02 [GPU] Remove a dangerous comment about break after exece [ci skip]
There can be jumps across an exece, so the code beyond it may still be
executed.
2023-05-05 21:32:02 +03:00
Triang3l 53f98d1fe6 [GPU/D3D12] Memexport from anywhere in control flow + 8/16bpp memexport
There's no limit on the number of memory exports in a shader on the real
Xenos, and exports can be done anywhere, including in loops. Now, instead
of deferring the exports to the end of the shader, and assuming that export
allocs are executed only once, Xenia flushes exports when it reaches an
alloc (allocs terminate memory exports on Xenos, as well as individual ALU
instructions with `serialize`, but not handling this case for simplicity,
it's only truly mandatory to flush memory exports before starting a new
one), the end of the shader, or a pixel with outstanding exports is killed.

To know which eM# registers need to be flushed to the memory, traversing
the successors of each exec potentially writing any eM#, and specifying
that certain eM# registers might have potentially been written before each
reached control flow instruction, until a flush point or the end of the
shader is reached.

Also, some games export to sub-32bpp formats. These are now supported via
atomic AND clearing the bits of the dword to replace followed by an atomic
OR inserting the new byte/short.
2023-05-05 21:32:02 +03:00
chrisps 1319ff6ead
Merge pull request #159 from chrisps/info_stubs_and_misc_kernel
[Kernel] Implement misc functions, bandaids for 415608D8
2023-05-01 10:13:49 -04:00
chss95cs@gmail.com dcb98683cf Replace most magic numbers from previous commit with named constants, if the constants names are known.
Instead of low 32 bits of ptr, use hash of file path for sector information.
2023-05-01 09:32:33 -04:00
chss95cs@gmail.com b270c59d0c Check for null string passed to Win32Thread::set_name
Move impl of XamAlloc into XamAllocImpl
Implement XamAllocEx
Implement XamIsCurrentTitleDash
Implement XamGetLocaleDateFormat
Implement "stub" of XFileFsDeviceInformation, XFileSectorInformation (log warnings when they're executed so this doesnt get mistaken for an actual implementation)
Added xboxkrnl_memory file
Moved meat of MmAllocatePhysicalMemoryEx into xeMmAllocatePhysicalMemoryEx, exposed its definition via xboxkrnl_memory.

Moved impl of RtlImageHeaderNt into a helper function
Implement RtlImageDirectoryEntryToData
Implement KeSuspendThread
Check for bad handles passed in XOVERLAPPED, fixes crash in 415608D8
2023-04-30 13:22:49 -04:00
Radosław Gliński 37051afcaf
Merge branch 'xenia-project:master' into canary_experimental 2023-04-26 13:34:57 +02:00
Gliniak 94759861c5 [Kernel] Implemented: NtAllocateEncryptedMemory 2023-04-26 08:37:39 +02:00
chrisps 9992d20079
Merge pull request #157 from chrisps/canary_experimental
[VFS] Show fatal error message for disc images with out of bounds entries
2023-04-23 13:19:13 -04:00
chss95cs@gmail.com c86233cc80 Detect corrupted xiso images that have file entries that are out of range and show a fatal error. 2023-04-23 12:52:03 -04:00
chrisps 1b307ae129
Merge pull request #156 from chrisps/misc_krnl4_23_23
[Kernel] Misc fixes, stubs
2023-04-23 11:51:31 -04:00
chss95cs@gmail.com 2fa2f1a78c Add more wrapper functions to ppc_context_t in kernel, want to switch…
… over to referencing state through ppc_context as much as possible, it'll make implementing things like kernel processes much easier in the future

Move forward definitions of kernel types into kernel_fwd.h

Stub implementation of  XamLoaderGetMediaInfoEx
Partially implement XamSetDashContext
implement XamGetDashContext
Stub implementation of XamUserIsUnsafeProgrammingAllowed
Stub implementation of XamUserGetSubscriptionType
Expanded the supported object types for ObReferenceObjectByHandle and wrapped the logic for encoding the type in a constexpr function
ObReferenceObjectByName was taking lpstring_t for first param, but the function actually takes X_ANSI_STRING ptr

NtReleaseMutant actually does not return anything from KeReleaseMutant, it just checks the handle and returns whether it was invalid.

Changed the raise/lower irql functions to just set the irql on the pcr instead of setting it on field of Processor, processor is a shared object and irql is per-thread

Semi-stub implementation of KeGetImagePageTableEntry. I locked at it in the HV and got it so the values are in the same range the HV returns + actually reflect the page & memory range, but i doubt its equal to the values the hv returns on real hw. Used by modern dashboards, don't know for what.
Log error message for ObDereferenceObject w/ null ptr.

Allocate a special fixed page that dashboards reference, currently don't know what the data on that page is supposed to be.
Add current_irql field to X_KPCR
Added Device object member of XObject::Type enum
Added some notes about other gpu registers, found a table of register names and indices in xam
2023-04-23 10:39:52 -04:00
Gliniak caddaa509a [UI] Disable achievements notifications from default to prevent ingame spam
Seems like a lot of titles like to spam this randomly and do not track internally if
achievement was unlocked or not.
2023-04-23 10:55:49 +02:00
Triang3l 8aaa6f1f7d [SPIR-V] Wrap 4-operand ops and 1-3-operand GLSL std calls 2023-04-19 21:44:24 +03:00
Triang3l 19d56001d2 [SPIR-V] Wrap NoContraction operations 2023-04-19 11:53:45 +03:00
Triang3l 78f1d55a36 [SPIR-V] Use Builder createSelectionMerge directly 2023-04-19 11:11:28 +03:00
Triang3l 64d2a80f79 [SPIR-V] Cleanup ALU emulation conditionals 2023-04-19 10:35:09 +03:00
Triang3l eede38ff63 [SPIR-V] Remove more vec2-4 reserve calls 2023-04-18 22:05:02 +03:00
chrisps fecd1e6a40
Merge pull request #153 from chrisps/misc_kernel_additions
Misc kernel additions/changes
2023-04-16 18:49:08 -04:00
chss95cs@gmail.com 1f86dc0454 Check for and allow null critical sections, but log them.
stub XeKeysGetConsoleType
Removed the breakpoints in HandleCppException and RtlRaiseException until we have a real implementation of them. Some apps can continue fine afterwards.
Stub version of HalGetCurrentAVPack
Implement MmIsAddressValid
Implement RtlGetStackLimits
2023-04-16 17:34:46 -04:00
chrisps 779be8283d
Merge pull request #151 from chrisps/extreme_logging_helpers
Command Processor debug logging changes
2023-04-16 13:20:14 -04:00
chss95cs@gmail.com 27c4cef1b5 Added logger flags, for selectively disabling categories of logging (cpu, apu, kernel). Need to make more log messages make use of these flags.
The "close window" keyboard hotkey (Guide-B) now toggles between loglevel -1 and the loglevel set in your config.
Added LoggerBatch class, which accumulates strings into the threads scratch buffer. This is only intended to be used for very high frequency debug logging. if it exhausts the thread buffer, it just silently stops.
Cleaned nearly 8 years of dust off of the pm4 packet disassembler code, now supports all packets that the command processor supports.
Added extremely verbose logging for gpu register writes. This is not compiled in outside of debug builds, requires LogLevel::Debug and log_guest_driven_gpu_register_written_values = true.
Added full logging of all PM4 packets in the cp. This is not compiled in outside of debug builds, requires LogLevel::Debug and disassemble_pm4.
Piggybacked an implementation of guest callstack backtraces using the stackpoints from enable_host_guest_stack_synchronization. If enable_host_guest_stack_synchronization = false, no backtraces can be obtained.
Added log_ringbuffer_kickoff_initiator_bts. when a thread updates the cp's read pointer, it dumps the backtrace of that thread
Changed the names of the gpu registers CALLBACK_ADDRESS and CALLBACK_CONTEXT to the correct names.
Added a note about CP_PROG_COUNTER
Added CP_RB_WPTR to the gpu register table
Added notes about CP_RB_CNTL and CP_RB_RPTR_ADDR. Both aren't necessary for HLE
Changed name of UNKNOWN_0E00 gpu register to TC_CNTL_STATUS. Games only seem to write 1 to it (L2 invalidate)
2023-04-16 12:42:42 -04:00
chrisps 9463f18a65
Merge pull request #150 from chrisps/timestamp_bundle_changes
KeTimestampBundle changes
2023-04-16 10:40:15 -04:00
chss95cs@gmail.com ab21e1e0f0 Several changes for timestamp bundle:
Fully defined the structure.
Single copy of it + single timer across all modules, managing it is now the responsibility of KernelState.

add global_critical_region::PrepareToAcquire, which uses Prefetchw on the global crit. We now know we can use Prefetchw on all cpus that have AVX.
add  KeQueryInterruptTime, which is used by some dashboards.

add threading::NanoSleep
2023-04-16 10:08:01 -04:00
chrisps 12c9135843
Merge branch 'xenia-project:master' into canary_experimental 2023-04-16 09:11:39 -04:00
chrisps 26dc48f695
Merge pull request #149 from chrisps/canary_experimental
reimplement reserved load/store
2023-04-15 17:23:22 -04:00
chss95cs@gmail.com e75e0425e0 forward branch for double-clear condition in reserved store 2023-04-15 16:22:37 -04:00
chss95cs@gmail.com 7fb4b4cd41 Attempt to emulate reserved load/store more closely. can't do anything for stores of the same value that are done via a non-reserved store to a reserved location
uses a bitmap that splits up the memory space into 65k blocks per bit.  Currently is using the guest virtual address but should be using physical addresses instead.

Currently if a guest does a reserve on a location and then a reserved store to a totally different location we trigger a breakpoint. This should never happen
Also removed the NEGATED_MUL_blah operations. They weren't necessary, nothing special is needed for the negated result variants.

Added a log message for when watched physical memory has a race, it just would be nice to know when it happens and in what games.
2023-04-15 16:06:07 -04:00
Triang3l 887fda55c2 [SPIR-V] Remove temp reserve for 4 or less elements 2023-04-13 22:43:44 +03:00
Triang3l 75d805245d [DXBC] `discard` pixels from `kill` with ROV instead of returning
Keep the current lane active as it may be needed for derivatives.
2023-04-09 20:13:22 +03:00
Gliniak 5e0c67438c Merge branch 'master' of https://github.com/xenia-project/xenia into canary_experimental 2023-04-09 17:28:04 +02:00
Gliniak 7fce8fce9d Revert "[D3D12] Added workaround for broken Geometry Shader in AMD 7900 Series GPU"
This reverts commit 2afd2cc4d6.
2023-04-09 17:27:55 +02:00
Triang3l 88c645d818 [D3D12] Don't use emit_then_cut due to RDNA 3 crash 2023-04-09 18:07:44 +03:00
chrisps 190cef9872
Merge pull request #148 from chrisps/canary_experimental
Do not check if we should show the prefetchw error message if we alre…
2023-04-02 17:37:05 -04:00
chss95cs@gmail.com 22dd2e52e6 Temporarily disable prefetchw check, odd report from user who definitely has prefetchw, but it is not being reported as present 2023-04-02 17:11:08 -04:00
chss95cs@gmail.com 356300d14c Do not check if we should show the prefetchw error message if we already have an avx error message.
mtmsrd writes the EE bit only now.
2023-04-02 14:26:01 -04:00
chrisps e9d1e51c32
Merge pull request #147 from chrisps/canary_experimental
setup initial value of MSR on ppc context
2023-04-02 08:36:48 -04:00
chss95cs@gmail.com 6ccdc4d0df setup initial value of MSR on ppc context
Fixed PrefetchW feature check
Added prefetchw check to startup AVX check, there should be no CPUs that support AVX but not PrefetchW.
Init VRSAVE to all ones.
Removed unused disable_global_lock flag.
2023-04-01 14:48:56 -04:00
Triang3l baa2ff78d8 [Vulkan] Add missing stencil reference unpack in RT transfer + formatting fix 2023-03-30 22:40:40 +03:00
Triang3l c238d8af55 [Vulkan] Fix FragStencilRef store type 2023-03-30 22:28:56 +03:00
Adrian 8678becda6 [XAM] StartupEx 2023-03-13 11:00:52 +01:00
Gliniak 23bd18cfca [GPU] Check if memory page is available while copying data 2023-03-11 16:20:01 +01:00
Gliniak eb5da8e557 [UI] Changed default UI font to Tahoma. If it's not available use embedded font
- Additionally allow user to provide own font size
- Forced font scaling in notification window to be reasonable size
2023-03-11 13:07:07 +01:00
Gliniak 9fa6e94772 [Achievements] Present notification in language selected by user 2023-03-08 13:24:55 +01:00
Gliniak 202ab76300 [Kernel] Changed default notification position 2023-03-08 10:59:08 +01:00