Commit graph

143 commits

Author SHA1 Message Date
kd-11 60f3059d22 rsx: Compensate for nvidia's low precision attribute interpolation
- The hw generates inaccurate values when doing perspective-correct
  interpolation of vertex output attributes and makes the comparison (a ==
  b) fail even when they are a fixed constant value.
- Increase equality tolerance when doing comparisons in fragment
  shaders for NV cards only to work around this issue.
- Teepo fix
2019-04-25 16:23:05 +03:00
kd-11 463b1b220d rsx: Improve accuracy of shadow compare Ops when non-integer depth formats are used
- The fixed-point D24S8 format does special Z clamping during compare which matches PS3 behaviour
- D32S8 is a floating point format and comparison with Dref > 1 always fails causing black edges/borders
2019-04-25 16:23:05 +03:00
kd-11 06a85f00d1 rsx: Shader decompiler cleanup and improvements
- Improve support for float16_t by minimizing mixed inputs to functions
(ambiguous overloads)
- Minimize amount of downcasts in code by using opcode flags
- Re-enable float16_t support for vulkan
2019-04-25 16:23:05 +03:00
kd-11 a668560c68 rsx: Use native half float types if available
- Emulating f16 with f32 is not ideal and requires a lot of value clamping
- Using native data type can significantly improve performance and accuracy
- With openGL, check for the compatible extensions NV_gpu_shader5 and
AMD_gpu_shader_half_float
- With Vulkan, enable this functionality in the deviceFeatures if
applicable. (VK_KHR_shader_float16_int8 extension)
- Temporarily disable hw fp16 for vulkan
2019-04-25 16:23:05 +03:00
Nekotekina bd9131ae1c Implement fs::get_cache_dir
Win32: equal to config dir for now
Linux: respect XDG_CACHE_HOME if specified
OSX: possibly incomplete
2019-01-13 14:45:36 +03:00
kd-11 4b79ef1ad9 rsx: Implement stencil mirror views
- Implements a mirror view of D24S8 data that accesses the stencil components.
  Finishes the implementation of TEX2D_DEPTH_RGBA as the stencil component was previously missing from the reconstructed data
- Add a few missing destructors
  Image classes are inherited a lot and I forgot to make the dtors virtual
2018-12-24 09:05:19 +03:00
kd-11 1ad76ad331 rsx: Restructure programs
- Also re-enable pipeline optimizations
2018-11-30 23:51:25 +03:00
scribam d7bb59cd99 c++17: use std::size 2018-09-06 13:15:59 +03:00
eladash f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
eladash 3e433ef05c create the shaderlog dir in Emu.Init() 2018-06-21 22:54:08 +04:00
scribam 04ad49de4d typos 2018-05-14 21:14:39 +04: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 4804efc17d rsx: Clear up confusion on depth writes.
According to the NV_fragment_program spec, its not feasible to have 16-bit depth wries
 NOTE: NV_fragement_program precedes NV_fragment_program2 which is very
 close to what RSX consumes. It is hardware from that era afterall
2018-03-13 18:55:03 +03:00
Jake 3a9428a88e rsx: Fix alpha test on VK/GL
Moving alpha test outside of fp_main. This enforces alpha test is still done even if shader asm has early return
2018-03-09 18:06:20 +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 320fb5f94c rsx/fp: Fix alphakill 2017-12-22 20:08:14 +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 4e9160104a rsx/vk/gl: Cleanup and refector glsl::getFunctionImpl
- Both backends now generate very similar code
2017-11-08 13:15:34 +03:00
kd-11 1fa18757fc rsx: Implement render-to-cubemap; Also simplify unnormalized samplers [WIP, DELETE SHADER CACHE, VERY SLOW]
- Enables real-time cubemap reflections
- TODO: Vulkan is broke; rsx is very slow with this feature
2017-11-08 13:15:34 +03:00
kd-11 fbb7186e66 rsx/gl: Addendum - Fix fragment shader to consume texture scale parameters 2017-11-08 13:15:34 +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 571dbfb7b1 rsx: Texture cache improvements
- Limits buffer size to min 720 in the Y axis (1024 section causes conflicts in some cases - TODO)
rsx: Fixups to allow large textures for blit operation
- Also includes checks for both leaking sections and blit regions for vulkan
hotfix for hanging when using WCB
addendum - unlock both ro and no blocks before attempting to copy memory blocks
gl: Fixups for ARB_explicit_uniform_location
- Forces glsl v 430 to make use of the extension
rsx/vk: Rework texture cache to minimize recursive access violations
- Also modifies the vulkan commandbuffer begin/end/submit mechanism
gl: Fix cached_texture_section::is_flushable to take memory protection into account
rsx: Fix blit dst offset calculation
2017-09-21 16:17:06 +03:00
kd-11 07c83f6e44 gl: cleanup; fix program linkage on mesa using GL_ARB_explicit_uniform_location, also make use of ARB_multidraw 2017-09-21 16:17:06 +03:00
kd-11 73312fc363 rsx: Several fixes and improvements
- Do not ignore non-centered pixel blitting
- Register method ac00+16
- Bump texture memory heap to account for GPU texture scaling requirements (vulkan)
- Explicit MRT location index output to better convey intent (openGL)
2017-09-21 16:17:06 +03:00
kd-11 f71f67c4ff rsx: Make fragment state dynamic to reduce shader permutations 2017-08-26 21:53:54 +03:00
kd-11 6a707f515e vk/gl: Factorize shared GLSL code
- prep vulkan for shared glsl backend
2017-08-16 23:58:30 +03:00
kd-11 a69f19a9ab rsx/decompilers: Avoid std::endl like the plague. It adds extra processing overhead 2017-06-29 13:13:19 +03:00
kd-11 b2e906f4cc rsx: Code cleanup. Fixes several dozen warnings
- Wrap unused parameters as comments to prevent C1400
- Fix sized variable conversions with explicit casts
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 6a9eef0382 rsx/gl/vk: Enable use of native PCF shadows 2017-06-22 23:36:15 +03:00
shameful e93c4c42b6 fix for shader fog mode exponential2_abs (#2781)
* Update VKFragmentProgram.cpp

added missing exponent parameter

* fixed misplaced exponent in VKFragmentProgram.cpp

parameter that belonged to pow() was being passed to exp() instead, causing the shader compilation to fail

* fix for opengl fog_mode exponential2

same fix as the vulkan version

* directx fog_mode exponential2 fix

misplaced parameter

* directx fog_mode exponential2_abs fix

* vulkan fog_mode exponential2_abs fix

* opengl fog_mode exponential2 fix
2017-05-14 12:56:24 +08:00
kd-11 8fa3f0721e fix false alphakill flags when texture fetch is optimized away 2017-03-24 09:30:23 +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 38562155d4 gl/vk: Flip wpos if origin != top 2016-09-28 07:22:45 +08:00
raven02 528b2d6c7b GL/Vulkan: not discard fragment when hits NEVER comparsion (#2156)
GL/Vulkan: return no operation when comparison is never
2016-09-26 21:59:38 +08:00
kd-11 7884356e90 gl/vk: Bug fixes and improvements (#2155)
* gl: Fix broken buffer reserve computation

* gl: Texture format fixes

* gl: Two sided lighting

* gl: Always update glsl output registers

* gl: Simplify vertex input declaration

* vk: Always write output registers

* vk/gl: swizzle component read on depth textures

* gl/vk: Use proper MVP matrix

gl: fix broken mvp when window_origin=top

* vk/gl: Move fragment operations block into the proxy function
2016-09-26 20:21:17 +08:00
kd-11 0d207a6c0d GL/Vulkan: Bug fixes and improvements; alphakill for vulkan (#2146)
* vk: Zero-initialize some more structs

* gl: Clean up fragment program generation code

* vk: Enable alpha kill

* vk: Fix surface clear; redirect output for surface_type:b

* vk: Tie renderpass to program object to avoid incompatible passes
2016-09-21 21:41:29 +08:00
kd-11 867e9210d7 gl/vk: Enable vertex texture fetch (#2127)
* gl: Enable vertex textures

* rsx: use textureLod instead of generic texture sample

* rsx: handle uploading of W32_X32_Y32_Z32

* gl: Re-enable proper shader logging

remove old logging method that overwrites single file

* gl: Declare texture_coord_scale for vertex samplers

* gl: texture remap fixes; enable remap for vertex textures

* gl: offset texture indices to base layer 16

* rsx: Fix W32_Z32_Y32_X32_FLOAT subresource layout

* vk: Enable vertex textures

* rsx: define special calls for vertex texture fetch

* gl: improved vertex texture fetch setup

* vk: Fix texture formats and component mapping

* vk: Implement vertex texture fetch functions properly

* vk/gl: proper fix for primitive restart index

revert inadvertent decompiler update

* gl: Disable filtering for vertex textures
2016-09-20 22:23:56 +08:00
Oil 153a2d2b40 Fixed fog and alphakill implementation in glsl (based on DH's old commits) (#2137)
* Fixed NV4097_SET_COLOR_CLEAR_VALUE

* Fixed fog and alphakill implementation in glsl (based on DH's old commits)
2016-09-14 22:47:53 +08:00
raven02 bb66b97251 GL: minor fixes (#2105)
* Minor fixes

* temporary disable 2-sided lighting

* Disable user clip planes until they are properly handled
2016-08-27 14:12:44 +08:00
raven02 6e07e07cd0 GL: enable 2-sided lighting (#2103) 2016-08-27 00:26:23 +08:00
Nekotekina cc46f2d7e6 LOG macro improved 2016-08-15 00:04:42 +03:00
Nekotekina ceb4cb59ac Typo fix: comparaison->comparison 2016-07-19 14:17:25 +03:00
kd-11 c4102f3b18 vk/gl: Enable alpha test in shaders (#1743) 2016-06-05 20:31:23 +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 17c4b2387e gl: Fix unnormalized coord sampling. 2016-03-31 00:12:41 +02:00
Vincent Lejeune 1dcc6858b4 d3d12/gl: Separate fog distance and fog frag in fogc input. 2016-03-05 18:25:31 +01:00
kd-11 8d3235cd7c Properly set up fog parameters for openGL 2016-03-03 01:07:53 +03:00
Vincent Lejeune 32434dd848 rsx/common/d3d12/gl: Support for fog mode.
Fix hitman 2
2016-02-29 16:31:18 +01:00
Vincent Lejeune 62246f75c8 d3d12/gl: Supports SSA in Fragment Shader. 2016-02-27 00:21:10 +01:00
Vincent Lejeune 1f7a1e4078 rsx/common/d3d12/gl: Fix lit and rsq behavior near 0 in vertex shaders. 2016-02-08 17:35:49 +01:00
kd-11 ddf5b52360 Implement rectangle textures natively on OpenGL 2016-02-07 08:57:04 +03:00
Vincent Lejeune 6aac972bda d3d12/gl: Use r1 as depth output.
The "Output_from_h0" flag seems to concern color output.
There might be another flag for depth from half float value.
2016-01-19 00:45:26 +01:00
Vincent Lejeune 69272edba6 gl: Fix warnings and enable trat warning as error. 2016-01-13 23:53:11 +01:00
Vincent Lejeune bab52c132d rsx/common/d3d12/gl: Clean ProgramStateCache
Use a_b_c format.
Use using =
Use tuple as output
Use RAII to delete program safely
Ensure const correctness.
2016-01-11 19:21:57 +01:00
Vincent Lejeune 675ccd4510 rsx/common/d3d12/gl: Mimic divsq and rsq fragment instruction behaviour with 0.
Fix Super Puzzle Turbo HD 2 and SH3 HD
2016-01-09 23:18:05 +01:00
Nekotekina 3ed603074c Changes done by [DH] rewritten
Added rsx_program_decompiler submodule
Added fs::dir iterator
Added fmt::match
2015-12-22 23:11:20 +03:00
Vincent Lejeune 6221fecf3b common/d3d12/gl: Start implementing cubemap sampling 2015-12-16 20:36:34 +01:00
Vincent Lejeune 929f518ef3 rsx/d3d12/gl: Make output write backend dependent. 2015-12-16 20:36:31 +01:00
Vincent Lejeune 399478c2cd gl: Use const and ref for loops in GLFragmentProgram.cpp 2015-11-29 18:20:43 +01:00
Vincent Lejeune 7a996648bb gl: Use fill_gragment_constans_buffer 2015-11-28 20:41:30 +01:00
DH 3721941ffb Fixed OpenGL renderer crash
Temporary downgraded OpenGL requirements to OpenGL 3.1 (GLSL 1.40)
Fixed some D3D12 Renderer compilation errors
2015-10-05 18:40:22 +03:00
vlj c3e19f34fa gl: sampler2d are constants 2015-08-12 00:26:33 +02:00
Nekotekina 3aefa2b4e1 ThreadBase rewritten (wip) 2015-07-10 04:31:16 +03:00
Vincent Lejeune 669a54d071 GL: Factorise getFloatTypeName, getFunction and compareFunction between Fragment and Vertex Decompiler 2015-05-23 20:45:10 +02:00
raven02 67e8e0a367 RSX: DP2A for fragment decompiler 2015-05-23 20:45:09 +02:00
vlj df794b88b0 GL: Use decompiler common class 2015-05-23 20:45:08 +02:00
B1ackDaemon 2a6f11b390 Merge pull request #1089 from vlj/gl
Store Vertex/Fragment program in a hashtable and do not rebuilt FP if a constant changes
2015-05-23 02:53:48 +03:00
B1ackDaemon d5ead0d315 Merge pull request #1091 from vlj/shader-fix
gl: Fix swizzle for DIVRSQ, COS, SIN in fragment shader
2015-05-21 19:13:46 +03:00
raven02 d0c2addf91 gl: Fix IFE instruction
This fixes the rsx_fp_static_test4.ppu.elf
2015-05-21 22:34:51 +08:00
vlj d58188d7ba gl: Fix swizzle for DIVRSQ, COS, SIN, EXP2, LOG2 in fragment shader
This fix rsx_fp_static_test2.ppu.elf, rsx_fp_static_test3.ppu.elf, rsx_fp_static_test5.ppu.elf.
Likely rsx_fp_dynamic_test2.ppu.elf too
2015-05-20 19:31:21 +02:00
vlj 2a7c65c019 GL: Use pipeline cache 2015-05-19 17:26:06 +02:00
Nekotekina f92c10ef71 Minor fixes 2015-05-08 12:45:21 +03:00
Raul Tambre 4b516273f6 Implement cellSaveDataListAutoLoad, fix textureProj 2015-02-19 22:56:57 +02:00
Raul Tambre 94c81c73c5 Implement more FP instructions 2015-01-24 21:30:36 +02:00
raven02 7880753099 FP: switch to version 420 2015-01-19 04:41:22 +08:00
DHrpcs3 1bf9e41c26 Forgot this one 2015-01-18 13:16:24 +02:00
DHrpcs3 482d470bf2 Small RSX fixes
- Fixed constants offset in FP decompiler.
- Fixed vertex textures initialization.
2015-01-18 12:51:30 +02:00
raven02 fffadb975b RSX : inline fragment naming as vertex shader 2015-01-02 08:06:42 +08:00
raven02 06907cb942 format fix 2014-12-29 06:37:32 +08:00
raven02 4907dedf69 RSX: Implement LIT instruction 2014-12-29 06:21:34 +08:00
Raul Tambre 108e879266 Fragment Program improvements and additions
+ Added TODOs for REFL, LIT, LRP, BEM, TEXBEM and TXPBEM
- Removed the warning message about TEX_SRB texture projection being
used
* Implemented packSnorm2x16, unpackSnorm2x16, packSnorm4x8 and
unpackSnorm4x8. All need more testing to be confirmed as working
2014-12-28 09:53:01 +02:00
Raul Tambre 240c209360 Fix TXB instruction 2014-12-27 11:00:44 +02:00
Raul Tambre 1bde52623b Fragment Program improvements
* Implement TXP (Needs testing)
* Implement TXB
* Implement TXL
2014-12-26 17:56:55 +02:00
DHrpcs3 e1ea7a28c3 Fixed condition decompilation in vertex & fragment shaders
Added 30 & 60 modes to frame limiter
2014-12-22 01:10:22 +02:00
raven02 3fc471eb32 RSX: shaders fix and vertex texture implementation 2014-12-17 22:01:59 +08:00
raven02 c0b4bf2f94 log error for unimplmented fpcode 2014-12-14 23:21:41 +08:00
Raul Tambre 9e5403aeb3 Remove unneeded be_t 2014-10-11 20:20:01 +03:00
Nekotekina a8cfefac07 vm::ptr for u8/char types, mem_list_ptr_t removed 2014-08-31 19:01:48 +04:00
Alexandro Sánchez Bach cf9769fe65 Fragment Shader recompiler comments
Don't expect changes due to this commit.
2014-08-18 22:07:52 +02:00
Alexandro Sánchez Bach f07c35d9ae Renamed Emu/GS -> Emu/RSX 2014-08-04 01:37:23 +02:00
Renamed from rpcs3/Emu/GS/GL/GLFragmentProgram.cpp (Browse further)