Commit graph

88 commits

Author SHA1 Message Date
Henrik Rydgård
6945deec01 Replace a LOT of sprintf with snprintf, and a few strcpy with truncate_cpy 2023-04-28 21:04:05 +02:00
Henrik Rydgård
68be93467e Fix some checks around translation. 2023-04-27 12:05:11 +02:00
Henrik Rydgård
6274eb7cae Follow the intent of the game's lookups rather than the practice, to reduce banding. 2023-04-25 23:17:40 +02:00
Henrik Rydgård
c70b71f945 Fix night vision in D3D9/ES2 as well. 2023-04-21 00:05:27 +02:00
Henrik Rydgård
913c460fe0 Fix night vision in SOCOM games (in fact, fix the CLUT8 effect properly)
I failed to notice that when doing the shift to apply the "texel offset"
translating CLUT8 to a CLUT16 lookup, we also need to shift the mask
used to choose color components to read.
2023-04-20 23:46:45 +02:00
Henrik Rydgård
db13fa6e66 Apply the SOCOM fix to D3D9/ES2 depal shaders too 2023-04-20 10:10:26 +02:00
Henrik Rydgård
9a3ff69091 Workaround for some SOCOM game's misuse of CLUT8 textures.
Emulating this correctly would be possible too but would only work at 1x
rendering resolution.
2023-04-17 09:34:26 +02:00
Henrik Rydgård
1938fa44d4 Split the depth copy shader into depth copy and depth encode, dynamic depth scale in Draw2D 2023-02-11 18:24:07 +01:00
Henrik Rydgård
a083a65f77 Depal: Get depth scale factors dynamically 2023-02-11 16:12:58 +01:00
Henrik Rydgård
d65dae7185 Depth scale functions: Clean up the naming, add a failing test 2023-02-10 14:57:45 +01:00
Unknown W. Brackets
26dc773b2a
Merge pull request #16709 from unknownbrackets/shader-errors
Correct some shader errors in reporting
2023-01-02 13:51:23 -08:00
Henrik Rydgård
ae99b797d7 Remove some bad float suffixes 2023-01-02 22:30:01 +01:00
Unknown W. Brackets
c8728a12d0 GLES: Use mod() not fmod() in depal shaders. 2023-01-02 13:25:40 -08:00
Unknown W. Brackets
761fdd353f GPU: Avoid large constant in depal shader. 2023-01-02 12:59:19 -08:00
Unknown W. Brackets
49f6c461ad Reporting: Fix some header includes.
Particularly in Common, avoid including Core/Reporting.h.
2022-12-27 14:58:20 -08:00
Henrik Rydgård
524e92374f Use arrays more consistently. 2022-10-27 11:05:59 +02:00
Henrik Rydgård
80e1db07a7 Minor ShaderWriter refactor, prep for later changes 2022-10-24 17:45:18 +02:00
Henrik Rydgård
ecf2797173 Minor refactor of ShaderWriter flags. Extracted from the stereo PR 2022-10-23 21:57:01 +02:00
Unknown W. Brackets
157ffed57f D3D9: Add simple rendered CLUT handling.
I think there's still a deeper half-pixel offset issue, but this fixes
Brave Story.
2022-10-08 15:36:36 -07:00
Henrik Rydgård
e8aaf22163 D3D9 crashfix (flare doesn't render correctly though) 2022-09-15 17:22:09 +02:00
Henrik Rydgård
9907957242 Start implementing ApplyTextureDepal 2022-09-14 22:18:35 +02:00
Henrik Rydgård
b4d0ac2e1c Unify CLUT texture size at 512 to reduce complexity. Worth the extra bytes. 2022-09-13 11:56:56 +02:00
Henrik Rydgård
322f29ce80 Comments and fixes 2022-08-27 23:37:02 +02:00
Henrik Rydgård
27ba7438eb Comment fix, cleanup 2022-08-27 10:05:47 +02:00
Henrik Rydgård
693fd0870f Bugfix, better logging 2022-08-26 23:26:44 +02:00
Henrik Rydgård
dfccdc6367 More successful swizzle impl. Not perfect 2022-08-26 16:16:11 +02:00
Henrik Rydgård
6aecbef11f Unsuccessful swizzle implementation 2022-08-26 16:06:45 +02:00
Henrik Rydgård
1ccfd7986a wip 2022-08-26 15:51:25 +02:00
Henrik Rydgård
4390a05fe0 Fix shader compilation error in depth->565 2022-08-26 15:13:32 +02:00
Henrik Rydgård
67c911d13f Fix smoothed CLUT lookups. Shouldn't go beyond the mask's reach.
Should help #15896
2022-08-24 17:13:36 +02:00
Henrik Rydgård
5084743bbb Use Draw2D for depal shaders (except the actual blit, for now) 2022-08-23 11:21:40 +02:00
Henrik Rydgård
e3943f6d0d Implement smoothed depal for the "old" depal path as well. 2022-08-22 15:34:26 +02:00
Henrik Rydgård
82a6c42e17 DepalettizeCommon -> TextureShaderCommon. Simplifications. 2022-08-22 12:21:20 +02:00
Henrik Rydgård
a11e7e167b More D3D9 work on depth textures. Something still missing. 2022-08-21 09:58:58 +02:00
Henrik Rydgård
5a7bddbfa6 Allow binding depth as 565 by going through depal.
This is a partial fix for #6105 (Ratchet & Clank particles visible
through things), but there's still weird glitchiness. There's a pass
during rendering that scrambles the mini depth buffer by using a
triangle mesh. I wonder if it's trying to simulate the swizzle? But it
doesn't really look like it...
2022-08-21 09:58:58 +02:00
Henrik Rydgård
295f5f391e More consistent handling of lack of depth texture support. Small log improvement. 2022-08-20 08:05:53 +02:00
Henrik Rydgård
31fe0fc39e Remove some unnecessary bool returns. 2022-08-16 11:23:34 +02:00
Henrik Rydgård
252550fbd2 Enable framebuffer depth blits through raster. Fixes games like Jeanne D'Arc on D3D9. 2022-08-09 20:00:32 +02:00
Henrik Rydgård
852c395fb7 Texcoord attrs must be called a_texcoord0, this should be fixed. Oh well.
Also small fix for depth in float-depal.
2022-08-09 16:07:02 +02:00
Henrik Rydgård
83fd8a2fd8 Convert depal shaders to use the ShaderWriter. Add tests for depal shaders. 2022-08-09 15:32:27 +02:00
Henrik Rydgård
9bd4201c83 Cleanup 2022-08-09 10:47:54 +02:00
Henrik Rydgård
9a678406b9 Remove BGRA color swap in depal for D3D, no longer needed (and breaks Simpsons) 2022-08-08 14:10:55 +02:00
Henrik Rydgård
87b128ecaf Compiles on Vulkan, but doesn't yet work. 2022-08-06 18:27:03 +02:00
Henrik Rydgård
2fa9b0d0c7 Simplify 2022-08-06 18:27:03 +02:00
Henrik Rydgård
8aebf0dca4 Port the OpenGL depal path to thin3d 2022-08-06 18:27:02 +02:00
Henrik Rydgård
90a44579bf Implement color-to-depth for Vulkan, start implementing for D3D11 2022-08-01 11:30:36 +02:00
Henrik Rydgård
90460df9b5 HLSL depal simplification 2021-07-09 21:09:44 +02:00
Henrik Rydgård
4e8ffae024 Implement basic depth texturing for OpenGL, requires depth clamp for now.
Need to figure out what to do about other Z mappings.

Helps #6411 for OpenGL on desktop primarily, and certain other games affected by #13256
are likely working too like the fog in Harry Potter.
2021-07-09 21:09:44 +02:00
Unknown W. Brackets
3c09b5c010 GLES: Always use fragColor0 on GL 3.0+. 2021-04-10 16:26:39 -07:00
Henrik Rydgård
03e8eac6ef Merge the two ShaderLanguage enums. 2020-11-04 09:40:11 +01:00