Commit graph

77 commits

Author SHA1 Message Date
kd-11 d41b49d8b4 rsx/fp: Color output registers are always present and zero initialized
- According to NV_fragment_program spec, registers are zero initialized always
- A program even without writing to these registers will have black (0, 0, 0, 0) output
  Confirmed behaviour with MotorStorm games. Their engine uses this quirk to clear color buffers when doing depth replace
  Might be an unfixed game bug
2018-03-13 18:55:03 +03:00
kd-11 68b3229756 rsx/fp: Improve rgister component gather detection
- Also avoids clobbering register data by keeping gathered bits in a temp var
2018-03-13 18:55:03 +03:00
kd-11 a64bea1286 rsx/fp: Discard shaders with undefined (non-existent) writes. On nvidia+vulkan, undefined writes autofill with blue color 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
kd-11 33bcdd476c glsl/fp/vp: Avoid shader clutter
- Do not add unused subroutines in shaders unless necessary
-- makes shaders easier to read and disassembled spir-v has less clutter
- glsl: Replace switch block with lookup table
2018-01-30 21:16:43 +03:00
kd-11 648fc92184 rsx/fp/vp: Epsilon value is too large!
- Original epsilon value was 1.E-10 which nvidia linux driver could not read properly
-- Restores the original value represented in decimal notation
2018-01-30 21:16:43 +03:00
kd-11 1ea5e7404a rsx: Workaround for nvidia linux
- For some reason, using 1.E-x notation does not work on nvidia linux. Could be a bug in spir-v generator or the driver itself
2017-12-31 12:43:40 +03:00
kd-11 47060cdc5f rsx/fp: Fix typo 2017-12-18 10:45:37 +03:00
kd-11 7dd349ae8e Update FragmentProgramDecompiler.cpp 2017-12-18 10:45:37 +03:00
kd-11 4e80858bed rsx/fp: Hotfix for TEXBEM/TXPBEM 2017-12-18 10:45:37 +03:00
kd-11 e89a035e8b rsx/fp: Implement TXPBEM 2017-12-18 10:45:37 +03:00
kd-11 f7c52d3bb7 rsx/fp: Implement TEXBEM (untested) 2017-12-18 10:45:37 +03:00
kd-11 6f8dd20f03 rsx/fp: Stuff
- Implement BEM
- Add LG2 to special instructions
2017-12-18 10:45:37 +03:00
kd-11 cdd4fd9867 rsx/fp: Explicitly insert global functions.
- Functions such as pack/unpack ops must exist before the shared gather functions are declared
2017-12-04 18:22:18 +03:00
kd-11 896c8991de rsx/fp: Properly implement PK/UP instructions based on NV_fragment_program documentation 2017-12-01 21:00:50 +03:00
kd-11 fe9090bd39 rsx/fp: Implement register gather (only for UP(X) instructions)
- Workaround for temp register aliasing between H and R variants
- TODO: Implement temp regs as 128 bit-blocks with r/w as pack/unpack
2017-12-01 21:00:50 +03:00
kd-11 a18ae0f6ac rsx/fp: Reimplement PK(X) and UP(X) opcodes. The read back values are obviously in normalized range
- Confirmed with a GOW shader which writes result of UP8 to BGRA8 output
2017-12-01 21:00:50 +03:00
kd-11 4d75e98647 rsx/fp: Do not apply input mods to all types of inputs
- Temp registers are confirmed to be affected
- Const registers are confirmed to be unaffected
- Varying inputs are not confirmed yet
2017-12-01 21:00:50 +03:00
kd-11 df7d52b177 rsx/fp: Give abs higher prio as it invalidates any precision checks 2017-11-20 15:18:57 +03:00
kd-11 f5addbf751 rsx/fp: improve SRC modifier order
- Neg modifier is applied after clamping. Abs has not been tested/proven so precision clamp goes first now, not last
2017-11-20 15:18:57 +03:00
kd-11 a8c0dd649e rsx/fp: RE work on precision modifier bits
- Testing DS2 has revealed clamping bits in SRC1 that were not respected and left negative values reaching the framebuffer
2017-11-20 15:18:57 +03:00
kd-11 3c9126d91f rsx: Ignore FENCE instruction as it seems like its ignored on realhw
- This is likely a compiler hint for performance reasons and not a mandate
2017-11-09 14:39:50 +03:00
kd-11 6b96a2022a rsx: Add support for non-projective shadow sampling
- Fixes missing shadows in persona 5

vk: Enable polygon depth bias a.k.a polygonOffset
- Fixes shadow acne in persona 5
2017-09-21 16:17:06 +03:00
kd-11 9359b8c170 rsx/fp: Shader decompiler fixes
- Requires proper 2-pass impl
rsx/fp: Catch hanging code blocks
rsx/fp: Don't pause on scaling error
2017-09-21 16:17:06 +03:00
kd-11 9e7a42d057 rsx: Minor bug fixes
- vk: Do not select first available format when choosing a swapchain format
- gl/vk: Ignore rendering zero sized framebuffers/scissors
- fp: Re-enable range clamp on fp16 registers; fix fx12 clamping [-2, 2]
2017-07-08 14:52:16 +03:00
kd-11 d43e06c0ea rsx: Fix some fp bugs
rsx/fp: Properly fix RCP
- Input is always scalar, output is a vector

rsx/fp: Ignore forced unit for SIP and TEX instructions
2017-07-08 14:52:16 +03:00
kd-11 d7662e54cc rsx/fp: Do not swizzle shadow lookups 2017-06-29 13:13:19 +03:00
kd-11 17318112eb rsx: Do not sample as pcf shader if writing a vector result 2017-06-22 23:36:15 +03:00
kd-11 110974af0b vk/gl: Fix sampling of shadow2D textures 2017-06-22 23:36:15 +03:00
kd-11 d5df4a4616 rsx/fp/gl: Minor fixes (#2823)
* rsx/fp: expand glsl unpack instructions to vec4

* rsx/fp: Ignore BRK outside LOOP/REP

* fix string compare typo
2017-06-01 15:53:25 +03:00
kd-11 18df292f90 rsx/fp: Better handling of flow control ops 2017-05-22 14:28:33 +03:00
Jochen Schleu ce7d62968e Only pass positive values to sqrt and log2 in the fragment program. (#2624) 2017-04-03 13:17:20 +03:00
kd-11 ef822d785e rsx/fp: src3 workaround 2017-03-24 09:30:23 +03:00
kd-11 1de2ceca9b rsx/vp: Fixes (#2533)
* rsx/vp: Fix rsq opcode broken in previous commit

* fix ms compiler error

* fix another possible conflict with ms d3d compiler
2017-03-14 16:05:59 +03:00
kd-11 be4bb48476 rsx/fp: Fix some decompiler bugs 2017-03-13 23:40:34 +03:00
kd-11 d6159a35aa gl/vk/dx12: Fix texture scaling on unnormalized rtt access 2017-02-11 15:45:59 +03:00
kd-11 5430e1d310 rsx/gl/vk/dx12: Add emulated texture fetch for depth read (#2173)
* rsx/gl/vk/dx12: Add emulated texture fetch for depth read

gl/vk/dx12: Simplify reinterpretation equation

* gl: Remove unnecessary re-swizzle

* glsl: explicitly cast uint to float
2016-09-29 14:54:32 +08:00
kd-11 38562155d4 gl/vk: Flip wpos if origin != top 2016-09-28 07:22:45 +08:00
Nekotekina 1f3433464c ENSURES usage removed 2016-08-14 22:41:01 +03:00
kd-11 35ab3b0cd8 gl/vk/dx12: re-implement pack/unpack operations (#1764)
dx12: implement pack/unpack operations

dx12: Fix shader compilation when pack/unpack is used

dx12: pk16/up16 - relax half-float range to more realistic values
2016-06-10 14:42:48 +03:00
raven02 db27ea923d VP: add few opcodes comment for vec/sca (#1750) 2016-06-10 01:03:43 +03:00
raven02 8f67c910ab FP: Implement REFL and LRP (#1712) 2016-06-04 10:23:45 +03:00
raven02 fc1408e643 FP: Implement texture lookup with explicit gradients (#1706) 2016-05-29 18:33:41 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
raven02 42423588c8 Use native function for OP_CODE_PK2/UK2 and UP2/UK2 2016-05-21 22:08:34 +08:00
Nekotekina b85a68e8a1 Partial commit: RSX 2016-04-15 19:22:36 +03:00
Raul Tambre a8e15ce18a Fix forced_unit for unimplemented instructions
For SCT and SCB, the forced unit is always set to FORCE_NONE before
handling of the instruction. This makes the error for unimplemented
instructions' forced unit be incorrect. This fixes that.
2016-04-07 21:34:32 +03:00
Vincent Lejeune 91d0229bc5 rsx/common: Use an help texture_dimension_extended to handle cubemap more cleanly. 2016-03-30 22:19:29 +02:00
Vincent Lejeune f2c82d3cf4 rsx/common: Use a typed class for texture dimension. 2016-03-30 20:03:50 +02:00
kd-11 843d0ed298 Fragment position is given as gl_FragCoord not gl_Position
Fix references to gl_Position in Dx12
2016-02-12 18:34:41 +03:00