Commit graph

92 commits

Author SHA1 Message Date
kd-11 b030d1900c rsx: Fixup - fix broken memory protection fail caused by region respec
- Some applications will alternate memory between framebuffer and texture data
2018-05-24 10:36:04 +03:00
kd-11 f8d999b384 fixup - range check 2018-05-23 19:07:08 +03:00
kd-11 3f14bc6961 rsx: Silence some meaningless error 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
scribam 04ad49de4d typos 2018-05-14 21:14:39 +04:00
kd-11 f3210a9a33 rsx: Workaround for lost memory sections
- TODO: surface_cache and texture_cache need a better method of persisting partial framebuffer resources
2018-04-25 19:14:36 +03:00
kd-11 291a828217 fixups 2018-04-25 19:14:36 +03:00
kd-11 da99f3cb9a rsx: Critical fixes
- texture cache: Avoid leaking memory sections
  - Avoid double ref increment on flush-always reprotection
  - Detect invalidated_resources entries in surface cache when protecting fbo memory
- vk: Copypasta bugfix, properly initialize aspect mask
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 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 cf1b700ebc rsx: Improve format mismatch detection hack 2018-04-25 19:14:36 +03:00
kd-11 e291494282 rsx: Texture cache updates
- Properly implement section gather for 3d and cubemaps
  Implements render-to-3d and fixes some corner cases for render-to-cubemap
2018-04-05 01:06:50 +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 9fc1740608 rsx/fp: Fragment program overhaul
- Separate TXB from TXL: They are completely different!
- Properly perform TMU emulation in the fragment shader. Implemens SRGB conversion and alphakill at the moment
- Properly perform ROP emulation in the fragment shader. Implements FRAMEBUFFER_SRGB. While support on the chip looks to be incomplete (and wierd), it does work
- Document some more bits in SHADER_CONTROL register
2018-03-25 13:31:06 +03:00
kd-11 9f416e5ce1 rsx/gl/vk: Obey channel remapping on framebuffer resources if requested 2018-03-25 13:31:06 +03:00
kd-11 5817f9fe3f rsx: Texture format fixes
- Implement SRGB (gamma corrected) textures (DXT1, DXT3, DXT5, RGBA8 only)
- Fix channel map decode for XY data texture formats
- Fix remap layout for X16 textures (verified with Mass Effect 3)
2018-03-25 13:31:06 +03:00
kd-11 e230867492 rsx: Properly implement raster window offsets 2018-03-13 18:55:03 +03:00
kd-11 20d4c09a1c rsx/vk/gl: Enforce format matching for render target resources. Fall back to raw data copy if match fails
- Forces Bitcast of texture data if input format cannot possibly be the
  same as the existing texture format

- rsx: Other minor improvements to texture cache :-
  - remove obsolete blit engine incompatibility warning. The texture will be re-uploaded if it is indeed incompatible
  - Implement warn_once and err_once to avoid spamming the log with systemic errors
  - Track mispredicted flushes
  - Reswizzle bitcasted texture data to native layout
    TODO: Also needs reshuffle according to input remap vector
2018-03-13 18:55:03 +03:00
kd-11 07cbf3da48 rsx/gl: Minor fixes
- Identify depth textures reaching the gpu via shader_read upload path
- Use correct timestamp counter for opengl
- inline draw_state::test_property because msvc doesnt do it for us
2018-03-13 18:55:03 +03:00
kd-11 01349b8cee rsx: Texture cache fixes - Optionally attempt to merge framebuffers into an atlas if partial resources are missing - Support for data update requests to the temporary subresource handler This is useful for framebuffer feedback loops where a new copy is needed after every draw call (resource is always dirty) 2018-03-13 18:55:03 +03:00
kd-11 4487cc8e7a Remove an ugly hack pertaining to partial framebuffer-resident texture data - Its better to fill in the missing information with a wrap or clamp than to fake the texture reads in valid regions - Texture coordinate scaling is used to fill in for the cropped dimension available 2018-03-13 18:55:03 +03:00
kd-11 661b8b006f rsx: Add texture readback statistics to the texture cache and debug overlay 2018-02-16 16:14:54 +03:00
kd-11 1bd77c2f51 rsx: Add cache pattern checking to blit engine resources
- Feature was implemented long ago but was not functional due to bugs
2018-02-16 16:14:54 +03:00
kd-11 3bbecd998a infinitesimal fixes 2018-02-16 16:14:54 +03:00
kd-11 89c548b5d3 rsx: fbo fixes 2.5
- Implement flush-always behaviour to partially fix readback from a currently bound fbo
  - Without this, only the first read is correct, as more draws are added the results become 'wrong'
  - Fixes WCB and cpublit behviour
- Synchronize blit_dst surfaces to avoid data loss when gpu texture scaling is used
  - Its still faster in such cases to disable gpu texture scaling but some types cannot be disabled without force cpu blit (e.g framebuffer transfers)
- Memory management tuning
  - rsx: on-demand texture cache rescanning for unprotected sections
  - rsx: Only framebuffer resources are upscaled
  - Do not resize regular blit engine resources
  - Lazy initialize readback buffer when using opengl
  -- These measures should help minimize vram usage
2018-02-16 16:14:54 +03:00
Nekotekina cce0ad0c35 Clean vm::ps3 namespace use 2018-02-09 17:49:37 +03:00
kd-11 eeb6e29e39 vulkan: implement proper texture read barriers 2018-02-02 10:07:55 +03:00
kd-11 b9cca71c47 gl: API compliance fixes
- Do not assume texture2D when creating new textures
- Flag invalid texture cache if readonly texture is trampled by fbo memory.
  Avoids binding a stale handle to the pipeline and is rare enough that it should not hurt performance
2018-02-02 10:07:55 +03:00
kd-11 6828fbf658 rsx/texture_cache: Remove hacks; it has been proven that in offsets are in x16 fixed point 2018-01-19 12:03:57 +03:00
kd-11 d6bc6ec2c1 rsx: fix initial swizzle ordering for render target data 2017-12-22 20:08:14 +03:00
kd-11 4a0c4259f0 c++ is hard
- Remove unnecessary const definitions
2017-12-22 20:08:14 +03:00
kd-11 6891323c18 rsx: framebuffer textures do not have mipmaps!
- Force mipmap count to 1 if sampling from an RTV/DSV
- TODO: Better wcb flush detection, it should be better to re-upload the texture after it has been dwnloaded if expected mipmaps are > 1
2017-12-18 10:45:37 +03:00
kd-11 7c7cd4153e rsx: Framebuffer setup fixes
- Sometimes square renders are done to surfaces with pitch=64 and re-uploaded with swizzle scanning
-- This setup avoids discarding targets if they are square and pitch == 64
2017-12-18 10:45:37 +03:00
kd-11 ff0f1510e5 rsx: Minor fixes
- Abort nv406e semaphore acquire if the rsx thread stalls/crashes
- Fix texture size approximation to take mipmaps into account. Fixes some games hanging with WCB
2017-12-18 10:45:37 +03:00
kd-11 3338fdb936 rsx: Fix RGB565 blits. Data is byteswapped on input
- Fixes messed up BG on retroarch glyphs
2017-12-18 10:45:37 +03:00
kd-11 6dfe32c6d2 fix linux builds 2017-12-18 10:45:37 +03:00
kd-11 95966a467e rsx: Texture cache fixes
- Handle blit resources in a more consistent way
- TODO: Handle some corner cases (piyotama)
2017-12-18 10:45:37 +03:00
kd-11 ac0022483a rsx: Implement delayed swizzle remap for blit engine resources
- Fixes remap vectors for memory copied via blit engine as it has no context
2017-12-18 10:45:37 +03:00
kd-11 0b3fbf1d4c rsx: Narrow the race condition window further
- Needs aliased paging to be implemented to fix properly or a re-entrant global IO lock
2017-12-06 12:55:49 +03:00
kd-11 a2b4cf22b5 rsx: Reimplement invalidate_range_base_impl
- Avoid unprotecting memory until just before we have to write the data
- Avoids race conditions where the caller thread takes too long to enter the second phase and another thread accesses the "bad" memory
2017-12-06 12:55:49 +03:00
kd-11 6c9c300fe0 rsx: Fix texture cache memory usage statistics 2017-12-01 21:00:50 +03:00
kd-11 ddebc334bf rsx: Fixes
- Discard intentionally invalidated framebuffer resources. These are created after a flush has happened, forcing reupload since contents cannot be guaranteed (strict mode only)
- Fix for blits using vulkan; dont use the copy method if formats do not match, use generic blit instead
2017-12-01 21:00:50 +03:00
kd-11 145ecb00fc rsx: Texture cache hotfixes 2017-12-01 21:00:50 +03:00
Zion Nimchuk 3a9ae2df9e silence warnings in RSX stuff 2017-11-30 18:07:19 +03:00
kd-11 6d2dcbd164 rsx: Enable hw blit engine for local->main memory blit operations as well 2017-11-20 15:18:57 +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 ed21bb309f rsx: Minor fixups
- Fix texture cache blit behaviour when src has AA enabled and dst is a blit dst texture with or without AA
-- This requires handling AA resolve by removing a half downscale on multisampled axes

- Return all ones when a vertex attribute is disabled.
-- Some games forget to enable vertex attributes actually needed by the fs
2017-11-08 13:15:34 +03:00
kd-11 8733505d0a rsx: Minor fixes
- texture_cache: Fix internal size calculation for subresources
- vk: Delay dynamic state updates until just about to draw to ensure no flush has discarded the cb state
2017-11-08 13:15:34 +03:00
kd-11 baa5a261a5 rsx: Rewrite invalidate_range_impl_base in a way that makes sense. Fixes wcb hanging 2017-11-08 13:15:34 +03:00
kd-11 3730b9d1da rsx: More fixes
- Support for raster offsets in surface descriptors (looks to be unused)
- Do not tag disabled render targets when using MRT (pitch = 64)
- Add missing notify_surface_changed() call for openGL
2017-11-08 13:15:34 +03:00