Commit Graph

333 Commits (c10ca98ccd71424670f8a6fb85576eb07a5097d5)

Author SHA1 Message Date
cosmonaut c10ca98ccd Remove some unused variables 2024-01-15 22:25:27 -08:00
cosmonaut d441424b7c Fix ANY_SHADER_READ_SAMPLED_IMAGE sync hazard 2024-01-15 21:41:36 -08:00
cosmonaut 55c77def69 Revert "Fix potential sync hazards (#49)"
This reverts commit 20636ec951.
2024-01-15 21:38:37 -08:00
cosmonaut 2634359b48 Texture size calculation fixes 2024-01-15 16:36:56 -08:00
cosmonaut 56e3eb2af5 1.15.3 2024-01-15 12:47:49 -08:00
cosmonaut 859fc3b9fa fix UBO buffer size 2024-01-13 23:45:07 -08:00
cosmonaut 05350a9332 UBO offsets should respect alignment 2024-01-13 23:39:58 -08:00
cosmonaut 760c29699f 1.15.2 2024-01-12 18:10:11 -08:00
cosmonaut 20636ec951 Fix potential sync hazards (#49)
We now do certain image layout transitions in the render pass instead of a barrier in EndRenderPass.

There is also an additional barrier on buffer uploads to prevent write-after-write hazard. It's a kludge on the fact that we're only tracking the most recent resource access.

Reviewed-on: MoonsideGames/Refresh#49
2024-01-12 18:10:11 -08:00
cosmonaut 7297eba889 Uniform buffers are now slices of dedicated allocs (#48)
This should fix an issue where draw calls could flicker if a defrag was in progress and a uniform buffer was being used.

Uniform buffer "pools" are now just a single dedicated VulkanBuffer, and the uniform buffer objects are offsets into that buffer.

Reviewed-on: MoonsideGames/Refresh#48
2024-01-13 01:41:12 +00:00
cosmonaut b72b0b5fde fix path quotes in shadercompiler 2024-01-11 16:26:08 -08:00
cosmonaut fa92e9e08a change dummy uniform buffer size to 1 2023-12-08 12:49:46 -08:00
cosmonaut 483c07f3a8 Vulkan: fix dummy UBOs becoming invalid after defrag 2023-12-05 12:22:40 -08:00
cosmonaut f01d5d817a Vulkan: fix some missed cleanup in DestroyDevice 2023-12-04 17:28:25 -08:00
cosmonaut 17aae46eae revert OSX deployment target to 10.9 2023-12-04 16:37:22 -08:00
cosmonaut 1b3e954da8 change render pass barriers to read-write 2023-11-09 11:00:19 -08:00
Evan Hemsley 0989e45f88 MoltenVK support 2023-10-14 22:14:00 -07:00
Evan Hemsley 6e6fec5224 bump OSX version to 10.15 2023-10-14 20:46:22 -07:00
cosmonaut 34b2e437de 1.15.1 2023-10-12 11:18:37 -07:00
cosmonaut d69bbbe818 fix Vulkan SDK include on Windows 2023-10-12 11:11:44 -07:00
cosmonaut 54a8ff122c Fix uniform buffers not tracking correctly 2023-10-12 11:11:27 -07:00
TheSpydog a15e26b124 Update Driver Template + Window Crash Fix (#46)
Some minor stuff that's cropped up from the D3D11 work so far. This PR updates the Driver_Template with the latest API, and also fixes a crash in the Vulkan driver -- if you acquired a swapchain texture from a window that had been destroyed, there was no null check before de-referencing the WindowData.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#46
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-09-30 17:50:48 +00:00
cosmonaut 172fa83417 1.15.0 2023-09-18 23:12:01 -07:00
cosmonaut a3949528eb Fence API (#45)
Reviewed-on: MoonsideGames/Refresh#45
2023-09-19 06:11:20 +00:00
cosmonaut f55968814f 1.14.1 2023-07-31 16:14:53 -07:00
cosmonaut c978df6275 remove unused variables 2023-07-31 16:12:20 -07:00
cosmonaut de42163673 rework Vulkan device selection and initialization 2023-07-31 16:06:47 -07:00
cosmonaut 4f412b5c15 fix refreshc breaking on file paths with spaces 2023-07-03 15:35:11 -07:00
cosmonaut c3a5d9f417 enable independentBlend feature 2023-06-16 15:00:47 -07:00
cosmonaut 9631dc9f83 1.14.0 2023-06-07 14:13:21 -07:00
cosmonaut 5a2b07097a SetTextureDataYUV rework (#44)
Reviewed-on: MoonsideGames/Refresh#44
2023-06-07 20:59:55 +00:00
cosmonaut 1f9f7e0939 Memory Management Rewrite (#41)
Various changes to reduce and optimize memory usage.

- Defragmenter
- Allocate 4 16MB transfer buffers for pool
- If transfer is larger than 16MB, create temporary transfer buffer
- Fixed some issues with CopyTextureToTexture

Reviewed-on: MoonsideGames/Refresh#41
2023-05-18 23:43:11 +00:00
cosmonaut 4df0459b04 1.13.0 2023-04-18 23:43:59 -07:00
cosmonaut 0f29bf03e9 Remove qoi.h 2023-04-18 23:43:23 -07:00
cosmonaut 74909b49c3 Redesign image API to be format agnostic (#40) 2023-04-19 06:42:44 +00:00
cosmonaut 3f5fe1ff67 1.12.0 2023-04-03 17:15:14 -07:00
cosmonaut 3fc743ce28 Add support for QOI format and reading images from memory (#39)
Reviewed-on: MoonsideGames/Refresh#39
2023-04-04 00:14:20 +00:00
cosmonaut 153c3c3c60 add missing texture formats to size function 2023-02-27 09:54:26 -08:00
cosmonaut decddae384 Fix MultipleThreads error on command buffer reset 2023-02-14 12:26:39 -08:00
cosmonaut 2d66ec775b 1.11.0 2023-02-07 12:26:46 -08:00
cosmonaut 8be8ce1062 shader output name includes shader type 2023-02-03 15:06:14 -08:00
cosmonaut 8eebd9c744 refreshc publish AOT 2023-02-03 15:05:53 -08:00
TheSpydog 1f2aaeed9f add msaa support for depth textures (#38)
Depth textures handle MSAA differently than color textures do, because there's no need for a resolve texture. This means the root VulkanTexture can have the sample count instead of needing an additional `msaaTex`.

This changeset also fixes a bug where the depth buffer wasn't getting cleared if there were MSAA color attachments.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#38
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-31 20:30:05 +00:00
TheSpydog 6439516835 ABI break: Textures now have a sample count, not render passes (#37)
This change makes Refresh behave more like FNA and other rendering APIs, where user-side textures have a sample count instead of generating MSAA RTs on the fly.

This should theoretically reduce memory consumption since subresource views no longer generate their own MSAA textures. Instead, each texture with a sample count > 1 now has a reference to an MSAA texture baked into the root texture itself, so views can just reference that.

This also simplifies VulkanRenderTarget significantly, to the point where it's just a wrapper around VkImageView. We could probably remove the abstraction entirely at this point.

Since VkRenderPass objects still require knowing the sample count, we can use the first bound texture's sample count. This means users only have to specify sample count in two places -- the graphics pipeline, and the texture. Easy enough.

I also noticed and fixed a bug with clear values with MSAA levels > 1.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#37
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-30 18:22:16 +00:00
TheSpydog 89ba9c52ff vulkan: Fix framebuffer creation with mip levels (#36)
Before this change, framebuffers were created based on the attachments' full dimensions, instead of the dimensions of the requested mip level. This fixes validation errors in the RenderTextureMipmaps test program.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#36
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-24 00:15:02 +00:00
TheSpydog e3ab5fadf8 vulkan: Fix 3D texture creation (#35)
The image type getting passed to imageCreateInfo was always VK_IMAGE_TYPE_2D, even for 3D textures. This fixes that bug, allowing Vulkan to successfully create 3D textures.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#35
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-24 00:13:23 +00:00
TheSpydog 05900bee14 Shader cross-compiler (#34)
This PR adds a shader cross-compiler program (written in C#) that uses glslc and spirv-cross to compile GLSL source files to a custom, Refresh-specific shader blob format that contains shader code for various backends.

The goal is that whenever you want to compile your shaders, you just run this program (either via `refreshc` or `dotnet run`), passing in the path to the GLSL source file. You can specify which backends you want to support via flags (`--vulkan`, for instance), and it will generate a .refresh blob file for Refresh to consume.

This can also be extended via C# defines and the `partial class` system. An example is the PS5 shader implementation, whose logic is squirreled away in the NDA'd repository but can be called in sequence with the rest of the shader cross-compile logic. This way, we don't have to run two separate programs to compile our shaders to all supported platforms.

Refresh handles all the parsing of the file format in Refresh_CreateShaderModule, so individual backends do not need to concern themselves with the particulars.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#34
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-20 23:19:12 +00:00
TheSpydog f7250ab12a Remove fixed command buffers + minor cleanup (#33)
Removes the `fixed` parameter from AcquireCommandBuffer, and removes a couple other unused bools from the VulkanCommandBuffer struct.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#33
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-14 18:03:58 +00:00
cosmonaut 903192cb4c Descriptor validation fix (#32)
The validator layer was complaining about us updating bound descriptor sets, this is technically a bug in the validator layer but resetting the command buffer in Cleanup makes more sense anyway. Also changed the wait for timeout call to a fence status query to make it easier to understand.

Reviewed-on: MoonsideGames/Refresh#32
2023-01-11 02:41:30 +00:00
cosmonaut 4cdd6a497a Fix transfer buffer alignment (#31)
Reviewed-on: MoonsideGames/Refresh#31
2023-01-07 05:24:58 +00:00