Commit graph

136 commits

Author SHA1 Message Date
Eladash 1ee7b91646 Refactoring (#6143)
Prefer vm::ptr<>::ptr over vm::get_addr.
    Prefer vm::_ptr/base over vm::g_base_addr with offset.
    Added methods atomic_t<>::bts and atomic_t<>::btr .
    Removed obsolute rsx:🧵:Read/WriteIO32 methods.
    Removed wrong check in semaphore_release.
    Added handling for PUTRx commands for RawSPU MFC proxy.
    Prefer overloaded methods of v128 instead of _mm_... in VPKSHUS ppu interpreter precise.
    Fixed more potential overflows that may result in wrong behaviour.
    Added io/size alignment check for sys_rsx_context_iounmap.
    Added rsx::constants::local_mem_base which represents RSX local memory base address.
    Removed obsolute rsx:🧵:main_mem_addr/ioSize/ioAddress members.
2019-06-29 01:27:49 +03:00
kd-11 1ee675e1f4 facepalm of the year
- Typo fix
- This check leads to forever relocating memory if size never exceeds capacity!
2019-06-25 20:50:54 +03:00
kd-11 d26b25816d rsx: Improve profiling setup
- Avoid spamming QPC when not needed
- Free performance when debug overlay is not enabled
2019-06-25 20:50:54 +03:00
Lassi Hämäläinen c963c51a60 Remove unnecessary header includes
- Manually removed lot of unneeded #includes to clean code and reduce
  compilation time
- Reordered some of the #includes to be in more logical order
2019-06-25 17:11:10 +03:00
Lassi Hämäläinen a070a414a6 Move rsx::constants and rsx::limits to rsx_utils.h 2019-06-25 17:11:10 +03:00
kd-11 acb14320da rsx: Fixup for resolution scaling support 2019-06-14 16:19:52 +03:00
kd-11 4a5bbba277 rsx: Enable MSAA
- vk: Enable depth buffer resolve+unresolve
- vk: Add AMD stenciling extension support
- rsx: Temporarily disables MSAA-compatible hacks such as transparency AA
- TODO: Add paths to optionally disable MSAA
2019-06-14 16:19:52 +03:00
kd-11 0d906d6974 rsx: Remove surface aa_mode hacks 2019-06-14 16:19:52 +03:00
scribam 44265aa27d rsx: Apply Clang-Tidy fix "modernize-use-equals-default" 2019-06-12 15:11:52 +03:00
scribam 801fa0113f rsx: Apply Clang-Tidy fix "readability-inconsistent-declaration-parameter-name" 2019-06-12 15:11:52 +03:00
kd-11 88290d9fab rsx: Hack around using data regions as transfer targets 2019-05-16 19:25:26 +03:00
kd-11 b840f6da28 [WIP] rsx: Use a sane reference counting model 2019-05-16 19:25:26 +03:00
kd-11 88c20afd3a rsx: Implement unaligned surface inheritance with hierachial contribution
- Allows render targets to behave like stacked 3D views same as shader inputs are resolved
- Basically implements most of 'Read Color/Depth Buffers" option for 'free'.
- Allows splitting RTV/DSV resources if they are superceded by a partial surface
- Also allows intersecting new resources through the surface cache for proper inheritance from other scattered data
- TODO: Refactor bind_surface_as_rtt and bind_surface_as_ds to reduce asinine code duplication
2019-05-16 19:25:26 +03:00
scribam 6c5ea068c9 Remove redundant semicolons
Fix "-Wextra-semi" warnings
2019-05-12 18:32:11 +03:00
eladash 7ead021aa7 rsx: Fix 3d swizzled texture to linear conversation 2019-05-08 23:48:39 +03:00
kd-11 4e3ec162e2 rsx: Fix broken texture cache search when flipping 2019-05-01 15:36:21 +03:00
kd-11 e4e86455f2 rsx: Fix temporary subresource caching behaviour
- Do not cache if a gathered subresource contains a bound RTT
- Change op to dynamic copy if parent is still bound
2019-04-09 13:40:54 +03:00
kd-11 443fde760f rsx: Blit engine clipping fixes
- Do not round up sub-pixel offsets, round down instead
- Do not allow incomplete sources for hw blit transfer
- Reimplement src clipping (slice_h)
- Check 'area' of incoming texels and correct for them before RTT lookup/transfer
- Filter out incomplete targets when performing RTT lookup (1 texel or less contribution)
2019-04-09 13:40:54 +03:00
kd-11 21bc6c7a87 rsx: Properly resolve data for upload when needed.
- Avoids blindly reusing blit dst sections as they may contain garbage.
  If a section was unlocked for a flush, just discard it as its reuse introduces potential data corruption.
  Since the data needs to be reuploaded anyway (for now), its better to start afresh
- In case of format mismatch, reset the calculated dst block
- Add a bounds check to determine if data contained in an atlas is good enough for sampling the cache.
  If not enough data is provided, fall back to full upload
2019-03-10 16:09:05 +03:00
kd-11 7c379432dd rsx: Implement proper pitch compatibility lookup
- When a single row is required or is all that is available, pitch has
no meaning as the coordinate space changed to 1D
2019-03-10 16:09:05 +03:00
kd-11 10dc3dadee rsx/texture_cache: Improve framebuffer memory locking when WCB/WDB is not enabled
- Adds a new mode that removes non-framebuffer stuff inside framebuffer range
2019-03-10 16:09:05 +03:00
kd-11 ef071ebb6b rsx: Synchronize surface cache and texture cache data
- TODO: The whole upload_texture thing is a big hack, fix it properly
2019-03-10 16:09:05 +03:00
kd-11 7e33cdcb08 rsx: simple_array<T> improvements
- Implement move and copy ctors
2019-01-25 14:34:22 +03:00
kd-11 95245bdd83 rsx: Improve ARGB8->D24S8 casting
- Set up partial transfers
- Force clear of target before starting the transfer
2019-01-06 10:44:40 +03:00
kd-11 9c46386dd4 rsx: Check av configuration when selecting display buffers!
- Some applications have mismatch between video output configuration and display buffer sizes
2018-12-24 09:05:19 +03:00
kd-11 f48abde14b rsx: Fixups for immediate rendering mode
- Immediate mode is isolated from the rest of the vertex configuration
- TODO: Verify register behaviour when immediate mode is used
  Check if per-primitive const register values are supported (likely are)
2018-12-24 09:05:19 +03:00
eladash 45942c4962 Fix segfault when scaled image dimension is less than clip's 2018-12-04 13:01:29 +03:00
eladash fa5652fceb rsx image_in: Implement negative scaling 2018-12-04 13:01:29 +03:00
kd-11 504ab5a6d4 rsx: Minor cleanup to silence stupid compiler warnings 2018-12-03 20:01:23 +03:00
kd-11 677b16f5c6 rsx: Fixups
- Also fix visual corruption when using disjoint indexed draws

- Refactor draw call emit again (vk)

- Improve execution barrier resolve
  - Allow vertex/index rebase inside begin/end pair
  - Add ALPHA_TEST to list of excluded methods [TODO: defer raster state]

- gl bringup

- Simplify
  - using the simple_array gets back a few more fps :)
2018-11-30 23:51:25 +03:00
eladash a92ae827c1 rsx: Remove texture mipmap hack 2018-10-03 20:57:46 +03:00
Nekotekina da6ce80f4f Make vm::get_super_ptr return contiguous memory
Cleanup RSX code complexity
2018-09-27 23:37:13 +03:00
kd-11 a3d44b5e1f rsx: Cleanup changes for the flip patch 2018-09-24 16:44:02 +03:00
Rui Pinheiro 35139ebf5d Texture cache cleanup, refactoring and fixes 2018-09-24 15:26:40 +03:00
Nekotekina ed9fb8405b Move rotate/cntlz/cnttz helpers to Utilities/asm.h 2018-09-08 00:32:04 +03:00
Nekotekina 5afd12e8a4 [CMake] Use C++17 2018-08-24 16:44:19 +03:00
kd-11 f3d3a1a4a5 rsx: Rework section reuse logic 2018-08-22 17:22:54 +03:00
kd-11 38191c3013 rsx: Avoid acquiring the vm lock; deadlock evasion
- A possible deadlock is still present if rsx is trying to get a super_ptr whilst the vm lock holder is in an access violation
  This patch makes this scenario very unlikely since each block need only be touched once
2018-08-18 16:14:30 +03:00
kd-11 d266a25618 silence some annoying warnings 2018-07-09 13:06:00 +03:00
kd-11 2ca935a26b vp: Improve vertex program analyser
- Adds dead code elimination
- Fix absolute branch target addresses to take base address into account
- Patch branch targets relative to base address to improve hash matching
- Bumps shader cache version
- Enables shader logging option to write out vertex program binary,
  helpful when debugging problems.
2018-07-07 16:20:33 +03:00
Jake 00c9b323c2 rsx: fix image_in to use in_pitch when swizzling 2018-06-24 14:29:41 +04:00
kd-11 3150619320 rsx: Preserve read AA state separate from write AA state
- Some applications (e.g Backbreaker) use an evil hack to resolve MSAA.
  The application respecifies a formerly AA region as a region with no AA then performs a framebuffer feedback lookup.
  The old memory keeps AA during read, but writes back to itself with AA resolved.
  This is evil on several levels but it just happens to work on PS3
2018-06-08 22:17:50 +03:00
kd-11 0f24379c0e rsx: Obey MSAA resolve during memory persistence transfer
- Ugh. This is a bandaid on a festering wound, AA badly needs a rewrite

 Also silence some warnings
2018-06-08 22:17:50 +03:00
kd-11 b957eac6e8 rsx: Avoid calling any blocking callbacks from threads that are not rsx::thread
- Defers on_notity_memory_unmapped to only run from within rsx context
- Avoids passive_lock + writer_lock deadlock
2018-05-23 19:07:08 +03:00
kd-11 d2bf04796f Optimized cached write-through
- Allows grabbing an unsynchronized memory block if overwriting contents
anyway
- Allows flushing only specified range of memory
2018-05-23 19:07:08 +03:00
kd-11 fbf6581249 rsx: Fix segmented memory access for rsx::super_ptr 2018-05-23 19:07:08 +03:00
kd-11 8fcd5c1e5a rsx: Texture cache fixes
1. rsx: Rework section synchronization using the new memory mirrors
2. rsx: Tweaks
    - Simplify peeking into the current rsx::thread instance.
      Use a simple rsx::get_current_renderer instead of asking fxm for the same
    - Fix global rsx super memory shm block management
3. rsx: Improve memory validation. test_framebuffer() and
tag_framebuffer() are simplified due to mirror support
4. rsx: Only write back confirmed memory range to avoid overapproximation errors in blit engine
5. rsx: Explicitly mark clobbered flushable sections as dirty to have them
removed
6. rsx: Cumulative fixes
    - Reimplement rsx::buffered_section management routines
    - blit engine subsections are not hit-tested against confirmed/committed memory range
      Not all applications are 'honest' about region bounds, making the real cpu range useless for blit ops
2018-05-23 19:07:08 +03:00
kd-11 eccb57d4b8 vk: AMD primitive restart bug workaround
- Emulate primitive restart with degenerate triangles
2018-05-13 14:44:14 +03:00
kd-11 291a828217 fixups 2018-04-25 19:14:36 +03:00
kd-11 91a6091d26 rsx: Minor fixes
- vk: Clear dirty textures before copying 'old contents' in case the old data does not fill the new region
- rsx: Properly decode border color - seems to be in BGRA format
- vk: better approximation of border color to better choose between the presets
- vk: Individually clear color images outside render pass and without scissor
- vk: Fix renderpass selection for clear overlay pass
- vk: Include scissor region when emulating clear mask

NOTES:
- vk: Completely avoid using vkClearXXXXimage - its 'broken' on nvidia drivers
  Spec is vague about the function so its not an actual bug
  ClearAttachment is clearly defined as bypassing bound state which works correctly
- TODO: Implement memory sampling to simulate loading precleared memory if cell used memset to preinitialize the framebuffer
  Autoclear depth to 1|255 and color to 0 is hacky!
2018-04-25 19:14:36 +03:00
kd-11 a42b00488d rsx: Texture fixes
- gl/vk: Fix subresource copy/blit
- gl/vk: Fix default_component_map reading
- vk: Reimplement cell readback path and improve software channel decoder
- Properly name the subresource layout field - its in blocks not bytes!
- Implement d24s8 upload from memory correctly
- Do not ignore DEPTH_FLOAT textures - they are depth textures and abide by the depth compare rules
- NOTE: Redirection of 16-bit textures is not implemented yet
2018-04-25 19:14:36 +03:00
kd-11 63d9cb37ec rsx: Framebuffer fixes
Primary:
- Fix SET_SURFACE_CLEAR channel mask - it has been wrong for all these
  years! Layout is RGBA not ARGB/BGRA like other registers

Other Fixes:
- vk: Implement subchannel clears using overla pass
- vk: Simplify and clean up state management
- gl: Fix nullptr deref in case of failed subresource copy
- vk/gl: Ignore float buffer clears as hardware seems to do
2018-04-25 19:14:36 +03:00
kd-11 9abbbb79ae rsx: Blit engine fixes
- Ignore unlocked blit sections [TODO]
- Do not attempt blit on hw if bytesize is unsupported
- gl: Implement typeless memory transfers
  Uses pbo to handle type-agnostic memory transfer
2018-04-25 19:14:36 +03:00
kd-11 c5cd758700 rsx: Workaround for G8B8 render targets
- Mainly affected are colormasks and read swizzles

NOTES:
- Writes to G write to the second and fourth component (YW)
- Writes to B write to first and third component (XZ)
- This means the actual format layout is BGBG (RGBA) making RG mapping actually GR
- Clear does not seem to have any intended effect on this format (TLOU)
2018-04-25 19:14:36 +03:00
kd-11 53f2533a08 rsx: Implement proper Z-order curve in 3 dimensions
- Should fix garbage palette textures getting uploaded (LSD graphics)
2018-04-05 01:06:50 +03:00
Jake 6d6d6fa827 dx12/vk/gl: implement use of vertex_data_base_index when calculating index 2018-03-30 13:30:04 +03:00
kd-11 321c360dcb rsx: Overhaul rendertarget sampling/shuffles
- Reimplements render target views used for sampling
- Optimizes access using an encoded control token
- Adds proper encoding for 24-bit textures (DRGB8 -> ORGB/OBGR)
- Adds proper encoding for ABGR textures (ABGR8 -> ARGB8)
- Silence some compiler warnings as well
- TODO: Real texture views for OGL current method is a hack
2018-03-25 13:31:06 +03:00
kd-11 c6a2525c9b video out: Set up video configuration options in fxm
- TODO: Actually do something with the values
2018-03-25 13:31:06 +03:00
kd-11 c191a98ec3 vulkan API fixes
- Fix for texture barriers
- vulkan: Rework texture cache handling of depth surfaces
- Support for scaled depth blit using overlay pass
- Support proper readback of D24S8 in both D32F_S8 and D24U_S8 variants
- Optimize the depth conversion routines with SSE
- vulkan: Replace slow single element copy with std::memcpy
- Check heap status before attempting blit operations
- Bump guard size on upload buffer as well
2018-02-16 16:14:54 +03:00
kd-11 98e50d3064 gl: Reuse framebuffer textures whenever possible 2018-02-16 16:14:54 +03:00
Jake efe6a6cf53 rsx: fixed emulated primitive restart 2018-01-24 16:28:09 +00:00
kd-11 71f69d1d48
rsx/overlays: Introduce 'native' HUD UI and implement some common dialogs (#4011) 2018-01-17 19:14:00 +03:00
Jake ac53fc54dc rsx: fix image_in arg and swizzle fix 2018-01-14 20:50:55 +03:00
kd-11 08b829dc22 rsx: wcb scaling fixes 2017-12-01 21:00:50 +03:00
kd-11 be6b5922dd rsx: research native texel byte order on cpu readback (WCB) [WIP] 2017-11-20 15:18:57 +03:00
kd-11 3d05e61f7e rsx/vk: Workaround for polaris primitive restart bug 2017-10-19 12:22:52 +03:00
scribam 0129c54ab6 Move optional.hpp as a submodule 2017-10-12 18:00:24 +03:00
kd-11 fc0f98b5db rsx: Res scaling improvements
- gl: Reintroduce the wcb hw downscaling
- rsx: Clamp scalable render target size with a config var
2017-10-09 20:25:41 +03:00
kd-11 3fe37ede97 rsx: Fixups
- gl: Remove redundant texstorage1D call
- gl: Disable the wcb scaling code as it doesnt work right yet [WIP]
- vk: Fix wcb reads
2017-10-09 20:25:41 +03:00
kd-11 12ab03b0b5 rsx/gl: Implement resolution scaling
rsx: Revise wpos calculation to take resolution scale into account
2017-10-09 20:25:41 +03:00
kd-11 3499d089e7 rsx: Texture cache fixes and improvements
rsx: Conditional lock hack removed
vulkan - Fixes
- Remove unused texture class
- Fix native pitch calculation (WCB)
rsx: Catch hanging begin/end pairs when flushing deferred draw calls
vulkan: Register DXT compressed formats
vulkan: Register depth formats
gl: Workaround for 'texture stitching' when gathering flip surface
- TODO: Add a proper flip hack option
rsx: Fix texture memory size calculation
- DXT textures dont have real pitch. Since pitch is used to calculate memory size, make sure it always evaluates to rsx_size
rsx: Fix cpu copy detection
rsx: Validate blit dst surface and dont make assumptions about region blit order
- Also relax restrictions on memory owned by the blit engine if strict rendering is not enabled
rsx: Fix depth texture detection
rsx: Do not manually offset into dst. The overlapped range check does so automatically
rsx: Minor optimizations
rsx: Minor fixes
- Fix to detect incompatible formats when using GPU texture scaling and show message
- Better 'is_depth_texture' algorithm to eliminate false positives
2017-09-21 16:17:06 +03:00
kd-11 7ab1792ef7 rsx: Implement conditional locks 2017-08-06 14:29:42 +03:00
kd-11 9aa632bcc1 rsx/vk: Fixes for ring buffer allocation and image clipping (#2850) 2017-06-10 23:32:17 +03:00
kd-11 e1a75deb25 rsx: Refactor image scaling code; Scale downloaded surfaces with vulkan 2017-05-10 21:50:14 +03:00
kd-11 fd754a4ddc vulkan: Start work on buffer synchronization
addendum - fix build

vulkan: separate cached section lifetime management

bug fixes
2017-05-10 21:50:14 +03:00
kd-11 9263999ad1 [rsx/vp] Improve BRB opcode implementation
fix merge issues
2017-02-26 10:17:34 +03:00
Nekotekina 0f87c4485d Silly macro removed-2 2016-08-14 18:19:42 +03:00
DHrpcs3 3b5cd4845e OpenGL renderer: use correct MVP matrix. Cleanup
Simplified gl::ring_buffer helper
2016-06-21 19:56:05 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
John ce3fdeda5e Replace math macros by function calls from cmath. (#1695) 2016-05-19 19:15:56 +03:00
Ivan 75fe95eeb1 GSL moved from stdafx.h (#1676)
Added GSL.h helper for correct including
2016-04-20 02:32:27 +03:00
Vincent Lejeune f453194e32 rsx: Fix int type not big enough
Fix glitch in After Burner Climax
2016-01-19 23:24:39 +01:00
Vincent Lejeune 69272edba6 gl: Fix warnings and enable trat warning as error. 2016-01-13 23:53:11 +01:00
DHrpcs3 ba12c489ec gl: using tiled region for read/write color buffers and flip
gl: fixed flip buffer row length
compilation fixes
2016-01-06 13:30:23 +02:00
DHrpcs3 509bbddac1 OpenGL renderer: use pitch as image row length
Fixed rsx_utils code style
2016-01-06 13:30:23 +02:00
DHrpcs3 836d14c8af rsx::pad_texture & rsx::convert_linear_swizzle moved to rsx_utils
Added rsx::convert_scale_image & rsx::clip_image to rsx_utils
2016-01-06 13:30:22 +02:00