Commit graph

35 commits

Author SHA1 Message Date
Wunkolo
cb64c52d2f Use inline rotl/ror
Fixes apple-clang builds, which do not implement a lot of the `bit`
header.
2023-08-20 23:01:43 -07:00
Wunkolo
c778c34433 Separate present/graphics workloads
Separate the "Display" texture from the cache of framebuffer textures,
move present/graphics into separate command buffers.
2023-08-20 23:01:43 -07:00
Wunkolo
50029e1333 Avoid usage of D24-S8 format
This support is not supported on `radv`. Vulkan mandates D16 only and a
combination of Depth and Depth-Stencil types only.
2023-08-20 23:01:43 -07:00
Wunkolo
27268f86d3 Fix instance-extension iteration
Add the extensions when they are available rather than statically
including them.
2023-08-20 23:01:43 -07:00
Wunkolo
6dcd09af3e Implement basic color/depth render-texture cache 2023-08-20 23:01:43 -07:00
Wunkolo
a36ee0025f Disable present queue when present unavailable. 2023-08-20 23:01:43 -07:00
Wunkolo
bf3917f074 Add subpass dependencies, optional depth attachment 2023-08-20 23:01:43 -07:00
Wunkolo
37902cd9d6 Implement a renderpass cache.
Technically we can generate every possible render-pass up-front based on
the possible combinations of ColorFmt and DepthFmt, but we should only
allocate what the game asks for. Save that pattern for pipelines.
2023-08-20 23:01:43 -07:00
Wunkolo
bf8bb5d459 Add vk_pica translation unit
Intended for conversions and utils between PICA definitions and Vulkan.
2023-08-20 23:01:43 -07:00
Wunkolo
d19b8cf364 Separate frame-work from presentation 2023-08-20 23:01:43 -07:00
Wunkolo
4976671ef0 Rename vulkan_api.hpp to vk_api.hpp
Consistant with other vulkan header patterns.
This header in particular is to configure our Vulkan API usage.
2023-08-20 23:01:43 -07:00
Wunkolo
ac1f7bc521 Remove dependency on C++20 ranges
AppleClang does not support this unfortunately
2023-08-20 23:01:43 -07:00
Wunkolo
e87db99a97 Remove ownership of SDL's vulkan-surface
This surface is managed by SDL itself, so there is no need to keep it in
a Unique handle for us to delete.  Fixes the bug where vulkan crashes
during shutdown.
2023-08-20 23:01:43 -07:00
Wunkolo
e3699fe8f8 Allocate and present separate top/bottom screen framebuffer images
Instead of operating directly on the swapchain images, we have our own
top/bottom framebuffer images that will be rendered to independent of
having an available swapchain. The images are blitted into the swapchain
images, allowing for resizing too!
2023-08-20 23:01:43 -07:00
Wunkolo
d0832ca558 Fix support for headless vulkan context 2023-08-20 23:01:43 -07:00
Wunkolo
17101e9bb9 Fix graphics queue assignment
Copy-paste error
2023-08-20 23:01:43 -07:00
GPUCode
82d9511993 gpu: Implement basic texcopy
* Improves rendering in FE:A but the screens will still not show
  because it requires surface validation
2023-08-06 14:43:30 +03:00
wheremyfoodat
9695b57bf5 [PICA] Rework how external registers work, format 2023-08-04 00:42:11 +03:00
wheremyfoodat
71bcfbab69 [Vulkan] Respect GPU_DEBUG_INFO 2023-07-24 19:23:47 +03:00
Wunkolo
e2e49b7291 Add in-place swapchain recreation
Lots of todos, this should probably just be its own self-contained
object to allow the emulator to render "headlessly" regardless of a
swapchain existing or not.
2023-07-23 21:44:39 -07:00
Wunkolo
c49fd71722 Use numeric_limits rather than ~0ULL 2023-07-22 19:44:09 -07:00
Wunkolo
af4163de19 Implement simple swapchain image clearing
Creates a swapchain, and per-swapchain image data for safe parallelism and synchronization.
2023-07-22 19:41:41 -07:00
Wunkolo
90a4c9cf8d Initialize command buffer allocationFix SDL_Vulkan_GetDrawableSize call 2023-07-22 17:13:13 -07:00
Wunkolo
fa804ae4c7 Implement swapchain draw loop
Verified on Windows and MacOS(M2)
2023-07-22 16:44:54 -07:00
Wunkolo
26c97eb716 Implement initial swapchain creation 2023-07-22 15:24:41 -07:00
Wunkolo
197e2a4bbd Allocate present/graphics/compute/transfer queue families 2023-07-22 14:23:37 -07:00
Wunkolo
da6f880128 Disable timeline semaphore features
This is an optional feature that can be supported conditionally later
2023-07-22 13:34:10 -07:00
Wunkolo
165134ca40 Consider surface-support in device partitions
Use a stable_partitioning of the list of devices the driver gave us with
the addition of checking of the physical device supports the
display-surface that SDL gave us as well.
2023-07-22 13:16:23 -07:00
Wunkolo
0ada1f4e38 Include additional vulkan-extensions that SDL requests
Required for proper surface creation. This gets the surface-creation
call to pass now.
2023-07-22 13:16:23 -07:00
Wunkolo
c7a93c4f52 Warn on failed surface creation for vulkan
Vulkan can technically work just fine without presenting to the user, so
consider these failed window procedures as "warnings" during iteration.
2023-07-22 13:16:23 -07:00
Wunkolo
444d50eaf5 Fix instance extensions on MacOS
These preprocessors were combining into a singular string rather than
the name of two individual extensions. Whoops.
2023-07-22 13:16:23 -07:00
Wunkolo
d9afb12daf Fix MacOS build 2023-07-22 13:16:23 -07:00
Wunkolo
b048d4dd6e Add SDL_Window to initGraphicsContext prototype
This value is needed for vulkan to properly allocate a surface, and would benefit OpenGL to move more of its initialization code into here rather than in `emulator.cpp`.
2023-07-22 13:16:23 -07:00
Wunkolo
870b6a21bf Add initial vulkan instance creation
Headlessly creates a new vulkan instance, with conditional MacOS
support, and enables the `VK_EXT_debug_utils` instance-extension with a
debug-messenger to hook onto validation layer messages.
2023-07-22 13:16:23 -07:00
Wunkolo
d2241a25bc Stub Vulkan backend support
A lot of the architecture of the emulator here does not allow for vulkan
to initialize easily since it involves a bit of data to be exchanged
between SDL and Vulkan. This commit just adds the foundational linkage
and library code for vulkan support.
2023-07-22 13:16:23 -07:00