Commit Graph

675 Commits

Author SHA1 Message Date
kalaposfos13
4abc6b3010 Implement getargc and getargv (#3562)
* Implement getargc and getargv

* update copyright year

* the loathsome clang-formatter
2025-09-09 14:58:22 -07:00
squidbus
e885d52ad0 vk_pipeline_cache: Fix pipeline log class. (#3560) 2025-09-09 04:48:12 -07:00
squidbus
e38876b5b2 amdgpu: Report GPU perf counter in GPU cycles. (#3557) 2025-09-08 19:17:35 -07:00
Stephen Miller
133f4b9187 Core: ClampRangeSize fixes (#3555)
* Swap !IsFree() for IsMapped()

IsFree only checks if the VMAType == Free. As is, that means ClampRangeSize will include memory that is Reserved or PoolReserved, and neither of those types are GPU mapped.

This fixes this bug, may help with some non-GPU memory asserts.

* Apply ClampRangeSize to vertex buffers

Helps with some cases encountered by UE and Minecraft.
2025-09-07 20:27:40 -07:00
TheTurtle
eb9a7e8fbd liverpool: Write valid queries on PixelPipeStatDump (#3553)
* liverpool: Write valid queries on PixelPipeStatDump

* export: Small assert swap

* liverpool: Advance zpass counter on every dump request
2025-09-07 18:08:26 -07:00
squidbus
d8e52c599b vk_pipeline_cache: Log pipeline creation. (#3544) 2025-09-07 23:13:26 +03:00
squidbus
38e6dd49b1 shader_recompiler: Support PointSize and ViewportIndex attributes. (#3541) 2025-09-06 20:11:46 -07:00
Stephen Miller
b2269f628a renderer_vk: Set image flag bits in resolve (#3518)
Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2025-09-04 14:47:04 -07:00
DanielSvoboda
4478b47666 Adjust 'image view type' error log (#3517)
* Adjust 'image view type' error log

* +
2025-09-04 14:46:21 -07:00
TheTurtle
35933d61fc tiling: Pass correct tile split to shader (#3515) 2025-09-04 13:16:35 -07:00
baggins183
df52585086 Allow vector and scalar offset in buffer address arg to LoadBuffer/StoreBuffer (#3439)
* Allow vector and scalar offset in buffer address arg to
LoadBuffer/StoreBuffer

* remove is_ring check

* fix atomics and update pattern matching for tess factor stores

* remove old asserts about soffset

* small fixes

* copyright

* Handle sgpr initialization for 2 special hull shader values, including tess factor buffer offset
2025-09-03 20:54:23 -07:00
rainmakerv2
77b1d11796 Qt: Add FSR options to settings GUI (#3504)
* Qt: Add FSR settings to settings GUI

* Move FSR settings from Imgui.ini to main config

* move passing fsr settings to presenter constuctor

* cleanup: use struct instead of function call

* cleanup: make variable names consistent with others

* Update fsr settings real-time in qt, save button in Imgui

* Linux build fix, missing running game check

* syntax fix

* Change gamerunning checks to if (presenter)
2025-09-02 12:03:33 -07:00
squidbus
9246b4277b config: Add present mode option. (#3502)
* config: Add present mode option.

* settings_dialog: Add details for present modes.
2025-09-01 16:42:31 -07:00
squidbus
31aa7539d3 sampler: Fix custom border color fallback condition. (#3489) 2025-08-30 18:42:49 -07:00
Stephen Miller
c26f56ab02 Handle offsets and format overrides in fetch shaders (#3486)
Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2025-08-30 14:20:23 -07:00
squidbus
af322c3a2f renderer_vulkan: Ignore blend parameters when disabled. (#3485) 2025-08-29 20:25:57 -07:00
squidbus
673b2afaa8 vk_platform: Remove workaround to use Vulkan loader on macOS. (#3484) 2025-08-29 18:29:34 -07:00
squidbus
62ddc0664b vk_scheduler: Properly initialize vulkan structures in RenderState. (#3479) 2025-08-29 17:28:20 -07:00
squidbus
e85308c011 vk_pipeline_cache: Add storage images to descriptor heaps. (#3472) 2025-08-29 08:03:14 -07:00
squidbus
8ed6572393 vk_graphics_pipeline: Prioritize depth clip when separate clip/clamp control is not supported. (#3471) 2025-08-29 07:45:53 -07:00
squidbus
25d1defb5b shader_recompiler: Do not emit Layer when emulating primitive type with tessellation. (#3457)
Layer must be output from the final pre-rasterization stage, so when tessellation is
being used the vertex shader cannot set it. We could pass it through to the tessellation
shaders in some way, but unless it becomes an issue that's more effort than it's worth.
2025-08-25 04:17:20 -07:00
TheTurtle
c90781d3e2 renderer_vulkan: Resore color write dynamic state (#3453) 2025-08-24 14:30:59 -07:00
TheTurtle
6d98a5ab60 vk_pipeline_cache: Cleanup graphics key refresh (#3449)
* vk_pipeline_cache: Cleanup graphics key refresh

* position: Don't assert on None mapping

Also check outputs in runtime info so shader is recompiled if they change
2025-08-23 17:16:58 -07:00
squidbus
6590f07772 video_core: Fix some struct comparisons. (#3450) 2025-08-23 17:16:52 -07:00
TheTurtle
6dd2b3090c shader_recompiler: Improve shader exports accuracy (part 1) (#3447)
* video_core: support for RT layer outputs

- support for RT layer outputs
- refactor for handling of export attributes
- move output->attribute mapping to a separate header

* export: Rework render target exports

- Centralize all code related to MRT exports into a single function to make it easier to follow
- Apply swizzle to output RGBA colors instead of the render target channel.
  This fixes swizzles on formats with < 4 channels

For example with render target format R8_UNORM and COMP_SWAP ALT_REV the previous code would output

frag_color.a = color.r;

instead of

frag_color.r = color.a;

which would result in incorrect output in some cases

* vk_pipeline_cache: Apply swizzle to write masks

---------

Co-authored-by: polyproxy <47796739+polybiusproxy@users.noreply.github.com>
2025-08-23 14:39:59 -07:00
Stephen Miller
7165772e9b Only queue image downloads if the image address is greater than zero. (#3446)
If the image address is zero, that means we're trying to download a null image, which causes other issues down the line.
2025-08-23 04:18:40 -07:00
squidbus
defd826a73 externals: Update MoltenVK (#3435) 2025-08-19 19:05:15 -07:00
TheTurtle
0b02364f97 ir: Perform degamma in shader when sampler sets force_degamma (#3420)
* ir: Perform degamma in shader when sampler sets force_degamma

* specialization: Add srgb if image is sampled

Might fix cases where sampler force_degamma is used with srgb image
2025-08-18 17:41:41 -07:00
squidbus
e7b97580b7 vk_instance: Temporarily disable maintenance8 for MoltenVK
Working on getting fix in for image copy issue.
2025-08-08 05:29:01 -07:00
TheTurtle
d9108cd39a video_core: Rework tile manager (#3374)
* video_core: Rework detiling

* video_core: Support tiling and macrotile detiling

* clang format

* image_info: Cleanups

* resource: Revert some changes

* texture_cache: Fix small error

* image_info: Set depth flag on depth promote

* buffer_cache: Remove level check

* tile_manager: Handle case of staging buffer causing flush

* image_info: Add 2D thick array mode

* image_info: Add slices to mip size

* tile_manager: Set bank swizzle

* buffer_cache: Support image copies from DmaData

* vk_rasterizer: Accelerate trivial render target copies with compute

Before tiling PR compute image copies were done with the following sequence

vkCmdCopyImageToBuffer (in SynchronizeBufferFromImage)  -> vkCmdDispatch (copy) -> vkCmdCopyBufferToImage (in RefreshImage)

With the tiling PR it added extra tiling/detiling steps

vkCmdCopyImageToBuffer -> vkCmdDispatch (tiling) -> vkCmdDispatch (copy) -> vkCmdDispatch (detiling) -> vkCmdCopyBufferToImage

This is quite a bit of overhead for a simple image copy. This commit tries to detect trivial image copies i.e cs shaders that copy the full source image to all of the destination.
So now all this sequence is just a vkCmdCopyImage. How much it triggers depends on the guest

* texture_cache: Fix build

* image: Copy all subresources with buffer too
2025-08-08 05:27:11 -07:00
Lander Gallastegi
841aa9e43d video_core: garbage collector (part 1) (#3350)
* Memory information

* Buffer cache GC

* Texture cache GC

* Fix ChangeRegister

* Better image touching

* Buffer async download on GC destroy

* Handle image download, SKIP NON-LINEAR WORKAROUND

* Only download when not dirty

* Correctly handle BDA pagefile update

* Restructure ChangeRegistration
2025-08-06 12:30:13 +02:00
TheTurtle
93767ae31b shader_recompiler: Rework sharp tracking for robustness (#3327)
* shader_recompiler: Remove remnants of old discard

Also constant propagate conditional discard if condition is constant

* resource_tracking_pass: Rework sharp tracking for robustness

* resource_tracking_pass: Add source dominance analysis

When reachability is not enough to prune source list, check if a source dominates all other sources

* resource_tracking_pass: Fix immediate check

How did this work before

* resource_tracking_pass: Remove unused template type

* readlane_elimination_pass: Don't add phi when all args are the same

New sharp tracking exposed some bad sources coming on sampler sharps with aniso disable pattern that also were part of readlane pattern, fix tracking by removing the unnecessary phis inbetween

* resource_tracking_pass: Allow phi in disable aniso pattern

* resource_tracking_pass: Handle not valid buffer sharp and more phi in aniso pattern
2025-07-28 13:32:16 -07:00
squidbus
d62d65af62 texture_cache: Do not modify mip height for copy in volume texture. (#3326) 2025-07-25 16:21:20 -07:00
Marcin Mikołajczyk
bd0102c8d0 Misc fixes (#3171) 2025-07-20 20:52:05 +03:00
TheTurtle
0b72a795eb vk_rasterizer: Improve stencil clears (#3268) 2025-07-19 02:39:54 +03:00
TheTurtle
2ae7037c08 texture_cache: Clamp buffer image height to microtile height (#3261)
Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-07-18 13:14:41 +03:00
TheTurtle
b56039b15a vk_pipeline_cache: Add fallbacks for R8Srgb and B5G6R5 (#3264)
* vk_pipeline_cache: Add fallbacks for R8Srgb and B5G6R5

* blit_helper: Fix validation error

* renderer_vulkan: Emulate B5G6R5 with swizzle
2025-07-18 12:25:07 +03:00
baggins183
3019bfb978 Implement MUBUF instructions for shorts/bytes (#2856)
* implement loads/store instructions for types smaller than dwords

* initialize s16/s8 types

* set profile for int8/16/64

* also need to zero extend u8/u16 to u32 result

* document unrelated bugs with atomic fmin/max

* remove profile checks and simple emit for added opcodes

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2025-07-18 12:04:50 +03:00
TheTurtle
cf8a6efd37 liverpool_to_vk: Don't use remapped format for clear value (#3254) 2025-07-16 01:54:56 +03:00
TheTurtle
6e350a5085 Avoid clearing HTILE when shader contains address calculation (#3252)
* resource_tracking: Mark image as written when its used with atomics

* texture_cache: Remove meta registered flag

Mostly useless and it is possible for images to switch metas

* vk_rasterizer: Use xor as heuristic for HTILE clear
2025-07-16 01:28:03 +03:00
TheTurtle
4407ebdd9b shader_recompiler: Implement guest barycentrics (#3245)
* shader_recompiler: Implement guest barycentrics

* Review comments and some cleanup
2025-07-15 18:49:12 +03:00
TheTurtle
87f6cce7b1 vk_instance: Remove usage of depth clamp control (#3248) 2025-07-15 18:36:13 +03:00
TheTurtle
00f4eeddaf renderer_vulkan: Handle more miscellaneous GPU settings (#3241)
* renderer_vulkan: Respect provoking vertex setting

* renderer_vulkan: Handle rasterization discard

* renderer_vulkan: Implement logic ops

* renderer_vulkan: Properly implement depth clamp and clip

* renderer_vulkan: Handle line width

* Fix build

* vk_pipeline_cache: Don't check depth clamp without a depth buffer

* liverpool: Fix line control offset

* vk_pipeline_cache: Don't run search if depth clamp is disabled

* vk_pipeline_cache: Allow using viewport range when it's more restrictive then depth clamp

* liverpool: Disable depth clip when near and far planes have different setting

* vk_graphics_pipeline: Move warning to pipeline

* vk_pipeline_cache: Revert viewport check and remove log

* vk_graphics_pipeline: Enable depth clamp when depth clip is disabled and extension is not supported

Without the depth clip extension depth clipping is controlled by depth clamping
2025-07-14 21:23:18 +03:00
TheTurtle
399a725343 shader_recompiler: Replace buffer pulling with attribute divisor for instance step rates (#3238)
* shader_recompiler: Replace buffer pulling with attribute divisor for instance step rates

* flatten_extended_userdata: Remove special step rate buffer handling

* Review comments

* spirv_emit_context: Name all instance rate attribs properly

* spirv: Merge ReadConstBuffer again

template function only has 1 user now

* attribute: Add missing attributes

* translate: Reimplement step rate instance id

* Resolve validation warnings

* shader_recompiler: Separate vertex inputs from LS stage, cleanup tess
2025-07-14 00:32:02 +03:00
TheTurtle
b403e1be33 vk_rasterizer: Set render area to max when no framebuffers are bound (#3227) 2025-07-10 22:14:02 +03:00
TheTurtle
27cbd6647f shader_recompiler: Reorganize data share operations and implement GDS bit (#3222)
* shader_recompiler: Reorganize data share operations and implement GDS bit

* Review comments
2025-07-10 13:38:50 +03:00
TheTurtle
7d4b875ee3 Random fixes (#3216)
* buffer_cache: Handle inline data to flexible memory

* control_flow: Fix single instruction scopes edge case

Fixes the following pattern

v_cmpx_gt_u32 cond
buffer_store_dword value
.LABEL:

Before
buffer[index] = value;

After
if (cond)
{
    buffer[index] = value;
}

* vector_memory: Handle soffset when offen is false

When offen is not used we can substitute the offset argument with soffset and have it handled correctly

* scalar_alu: Handle sharp moves with S_MOV_B64

This fixes unable to track sharp errors when this pattern is used in a shader

* emulator: Add log

* video_core: Bump binary info search range and buffer num
2025-07-09 17:00:06 +03:00
TheTurtle
2d1a2982df buffer_cache: Bring back upload batching and temporary buffer (#3211)
* buffer_cache: Bring back upload batching and temporary buffer

Because that PR fused the write and read protections under a single function call, it was a requirement to move the actual memory copy part inside the lambda to perform it before the read protection kicks in. However on certain large data transfers it had potential for data corruption. If, for example, an upload had two copies, a 400MB and a 300MB one, the first one would fit in the staging buffer, very likely with an induced stall. However the second one wouldn't have space to fit alongside the other data, but it's also small enough for the buffer to fit it, so the staging buffer would cause a flush and wait to copy it, overwriting the previous transfer.

To address this the upload function has been reworked to allow for batching like previously but with the new locking behavior. Also the condition to use temporary buffers has been expanded to also include cases when staging buffer will stall, which should increase performance a little in some cases.

* buffer_cache: Move buffer barriers and copy outside of lock range
2025-07-08 10:32:39 +03:00
TheTurtle
7fedbd52e0 texture_cache: Async download of GPU modified linear images (#3204)
* texture_cache: Async download of GPU modified linear images

* liverpool: Back to less submits

* texture_cache: Don't download depth images

* config: Add option for linear image readback
2025-07-07 16:23:20 +03:00
squidbus
70eef0de90 texture_cache: Change depth resolve new image back to max of resources. (#3205) 2025-07-07 13:03:19 +03:00