Commit Graph

358 Commits (6b39da7d2de030240b5ae4ddbf8bd6c737796040)

Author SHA1 Message Date
cosmonaut c978df6275 remove unused variables
continuous-integration/drone/push Build is passing Details
2023-07-31 16:12:20 -07:00
cosmonaut de42163673 rework Vulkan device selection and initialization
continuous-integration/drone/push Build is passing Details
2023-07-31 16:06:47 -07:00
cosmonaut 4f412b5c15 fix refreshc breaking on file paths with spaces
continuous-integration/drone/push Build is passing Details
2023-07-03 15:35:11 -07:00
cosmonaut c3a5d9f417 enable independentBlend feature
continuous-integration/drone/push Build is passing Details
2023-06-16 15:00:47 -07:00
cosmonaut 9631dc9f83 1.14.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2023-06-07 14:13:21 -07:00
cosmonaut 5a2b07097a SetTextureDataYUV rework (#44)
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #44
2023-06-07 20:59:55 +00:00
cosmonaut 1f9f7e0939 Memory Management Rewrite (#41)
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone Build is passing Details
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: #41
2023-05-18 23:43:11 +00:00
cosmonaut 4df0459b04 1.13.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2023-04-18 23:43:59 -07:00
cosmonaut 0f29bf03e9 Remove qoi.h
continuous-integration/drone/push Build is passing Details
2023-04-18 23:43:23 -07:00
cosmonaut 74909b49c3 Redesign image API to be format agnostic (#40)
continuous-integration/drone/push Build is passing Details
2023-04-19 06:42:44 +00:00
cosmonaut 3f5fe1ff67 1.12.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2023-04-03 17:15:14 -07:00
cosmonaut 3fc743ce28 Add support for QOI format and reading images from memory (#39)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #39
2023-04-04 00:14:20 +00:00
cosmonaut 153c3c3c60 add missing texture formats to size function
continuous-integration/drone/push Build is passing Details
2023-02-27 09:54:26 -08:00
cosmonaut decddae384 Fix MultipleThreads error on command buffer reset
continuous-integration/drone/push Build is passing Details
2023-02-14 12:26:39 -08:00
cosmonaut 2d66ec775b 1.11.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2023-02-07 12:26:46 -08:00
cosmonaut 8be8ce1062 shader output name includes shader type
continuous-integration/drone/push Build is passing Details
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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #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)
continuous-integration/drone/push Build is passing Details
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: #32
2023-01-11 02:41:30 +00:00
cosmonaut 4cdd6a497a Fix transfer buffer alignment (#31)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #31
2023-01-07 05:24:58 +00:00
cosmonaut 28b4253fdf 1.10.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2023-01-04 11:18:37 -08:00
TheSpydog e4215efe5e Enable multiDrawIndirect feature, add indirect command struct (#30)
continuous-integration/drone/push Build is passing Details
Fixes a validation error when attempting to draw multiple primitives via an indirect draw call. Adds some documentation for how indirect draw buffers should be set up.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: #30
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2023-01-04 18:44:02 +00:00
Caleb Cornett 329ffab6b8 Remove SRC1 blend factors and depthClampEnable flag
continuous-integration/drone/push Build is passing Details
2022-12-28 19:10:59 -08:00
Caleb Cornett 15b35fccfe update documentation + remove validation + misc cleanup
continuous-integration/drone/push Build is passing Details
2022-12-28 19:08:08 -08:00
TheSpydog ade74d73fe Perform pending destroys before unlocking the submit mutex (#28)
continuous-integration/drone/push Build is passing Details
This makes the order of VULKAN_Submit consistent with VULKAN_Wait.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: #28
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2022-12-29 03:03:35 +00:00
cosmonaut 124f202d2c Same-access-type barrier should not be a no-op
continuous-integration/drone/push Build is passing Details
2022-12-27 20:51:09 -08:00
cosmonaut 528abfad76 fix render target destroy segfault
continuous-integration/drone/push Build is passing Details
2022-12-22 17:23:11 -08:00
cosmonaut 59f9eeed36 1.9.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-11-09 12:04:01 -08:00
TheSpydog 297f234957 Miscellaneous API changes + more MSAA fixes (#26)
continuous-integration/drone/push Build is passing Details
**Breaking API Changes**
* Removed `REFRESH_SAMPLECOUNT_16/32/64`, since hardware support for these sample counts is generally poor (and completely non-existent with MoltenVK and certain consoles).
* Removed unused `sampleCount` parameter from `Refresh_TextureCreateInfo`.
* Removed `sampleCount` parameter from `Refresh_ColorAttachmentDescription`. The existence of this parameter meant you had to sync up three different sample count values (render pass, pipeline, and color attachment description) whenever you wanted to use multisampling. However, Vulkan requires that all color attachments in a given pipeline _must_ match the pipeline's sample count anyway, so we can assume all color attachments will use the pipeline's sample count.
* Removed the `renderArea` parameter from `Refresh_BeginRenderPass()` since it didn't serve much practical purpose and slightly complicated things on the MoonWorks managed side.

**Behavior Changes**
* When creating a render pass or graphics pipeline, the requested multisample count will be converted into a sample count that's actually supported by the GPU. For example, if you request 8x MSAA on a device that only supports up to 4x MSAA, it will silently fall back to 4x MSAA.
* All color attachments are now forced to have an internal store op of `STORE`, even if `REFRESH_STORE_OP_DONTCARE` is specified. The one exception is internal multisample textures -- if `DONTCARE` is used, those textures will be discarded to save on bandwidth. (Their resolve textures will still be stored.)
* The RenderPass hashing logic was updated so that it would still work correctly with the removal of `Refresh_ColorAttachmentDescription.sampleCount`.

**Bug Fixes**
* Fixed bugs where multisampling logic wasn't kicking in for certain sample counts due to incorrect enum comparisons.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: #26
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2022-11-08 19:09:21 +00:00
TheSpydog 5f05ef02a0 MSAA fixes (#25)
continuous-integration/drone/push Build is passing Details
- Fixed bug where multisample enum values were not being translated into their equivalent Vulkan enums
- Fixed bug where MSAA attachments in transient render pass creation were using a sample count of 1
- Fixed bug where the clearValues array in BeginRenderPass was not being populated with clear values for multisample attachments. (Modeled the fix after https://github.com/FNA-XNA/FNA3D/blob/master/src/FNA3D_Driver_Vulkan.c#L8723)
- Fixed bug where the multisample texture was not being transitioned when beginning a render pass

Reviewed-on: #25
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2022-11-03 19:50:07 +00:00
TheSpydog c4b9798fc1 enable samplerAnisotropy device feature (#24)
continuous-integration/drone/push Build is passing Details
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2022-11-02 21:23:48 +00:00
cosmonaut 5166ae87b2 1.8.2
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-11-01 16:26:27 -07:00
cosmonaut 3c7755d8bf rework window claim and swapchain acquisition
continuous-integration/drone/push Build is passing Details
2022-11-01 11:54:19 -07:00
cosmonaut 9073f68e0a Fix swapchain extent check when size is zero
continuous-integration/drone/push Build is passing Details
2022-10-31 14:16:32 -07:00
cosmonaut 403dcc6084 1.8.1
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-10-04 10:15:26 -07:00
cosmonaut fabd31448b fix backend iteration when backend is not compiled 2022-10-04 10:15:16 -07:00
cosmonaut 9aaead40a3 1.8.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-09-29 14:13:08 -07:00
cosmonaut 1a0beea402 Backend selection + swapchain API revision (#23)
continuous-integration/drone/push Build is passing Details
- The application must now call `Refresh_SetBackend` before creating the device
- `Refresh_SetBackend` can set a preferred backend, but will fall back if it is not available
- Device creation no longer takes presentation parameters
- Windows must now be explicitly claimed by the device
- Windows can be unclaimed by the device
- Windows can have their swapchain present mode changed after creation

Reviewed-on: #23
2022-09-29 21:11:25 +00:00
cosmonaut 5176f790d8 1.7.1
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-09-22 14:01:48 -07:00
cosmonaut f8bdf6fe1a fix texture copy memory barrier + optimize RT memory barrier
continuous-integration/drone/push Build is passing Details
2022-09-22 12:44:28 -07:00
cosmonaut 8f0ba8ffb2 1.7.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-09-13 13:55:25 -07:00
cosmonaut 5568ce4949 Fix heap iteration (#22)
continuous-integration/drone/push Build is passing Details
Fixes an issue where certain memory heaps could potentially be overlooked.

Reviewed-on: #22
2022-09-13 20:54:24 +00:00
cosmonaut f49c0ab190 Texture format rework (#21)
continuous-integration/drone/push Build is passing Details
- Adds number format information to the texture format names
- Adds several unsigned integer texture formats

Reviewed-on: #21
2022-09-13 20:51:41 +00:00
cosmonaut 764de140cc 1.6.1
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-08-25 16:21:45 -07:00
cosmonaut 06ad0e1901 fix barrier issue when sampling depth texture
continuous-integration/drone/push Build is passing Details
2022-08-25 16:20:35 -07:00