renderer_vulkan: Rework format handling
* This is a pretty large commit that aims to solve some issues with the current format system * The instance now builds at application initialization an array of format traits for each pixel format that includes information such as blit/attachment/storage support and fallback formats * The runtime doesn't ask the instance for formats but receives these traits and can dedice on its own what to build For now we do the same as before, we require both blit and attachment support * Morton swizzling also sees many bug fixes. The previous code was very hacky and didn't work for partial texture updates. It was also inconsistent, as it would take a tiled_buffer and write to the middle of linear * Now the functions have been greatly simplified and adjusted to work better with std::span. This fixes out of bounds errors and texture glitches (like the display in Mario Kart 7)
This commit is contained in:
@@ -44,19 +44,29 @@ class SurfaceParams;
|
||||
|
||||
[[nodiscard]] ClearValue MakeClearValue(SurfaceType type, PixelFormat format, const u8* fill_data);
|
||||
|
||||
void SwizzleTexture(const SurfaceParams& params, u32 start_offset, u32 end_offset,
|
||||
std::span<std::byte> source_linear, std::span<std::byte> dest_tiled);
|
||||
|
||||
/**
|
||||
* Converts a morton swizzled texture to linear format.
|
||||
*
|
||||
* @param params Structure used to query the surface information.
|
||||
* @param start_offset Is the offset at which the source_tiled span begins
|
||||
* @param unswizzle_info Structure used to query the surface information.
|
||||
* @param start_addr The start address of the source_tiled data.
|
||||
* @param end_addr The end address of the source_tiled data.
|
||||
* @param source_tiled The tiled data to convert.
|
||||
* @param dest_linear The output buffer where the generated linear data will be written to.
|
||||
*/
|
||||
void UnswizzleTexture(const SurfaceParams& unswizzle_info, PAddr start_addr, PAddr end_addr,
|
||||
std::span<std::byte> source_tiled, std::span<std::byte> dest_linear);
|
||||
|
||||
/**
|
||||
* Swizzles a linear texture according to the morton code.
|
||||
*
|
||||
* @param swizzle_info Structure used to query the surface information.
|
||||
* @param start_addr The start address of the dest_tiled data.
|
||||
* @param end_addr The end address of the dest_tiled data.
|
||||
* @param source_tiled The source morton swizzled data.
|
||||
* @param dest_linear The output buffer where the generated linear data will be written to.
|
||||
*/
|
||||
void UnswizzleTexture(const SurfaceParams& params, u32 start_offset, u32 end_offset,
|
||||
std::span<std::byte> source_tiled, std::span<std::byte> dest_linear);
|
||||
void SwizzleTexture(const SurfaceParams& swizzle_info, PAddr start_addr, PAddr end_addr,
|
||||
std::span<std::byte> source_linear, std::span<std::byte> dest_tiled);
|
||||
|
||||
} // namespace VideoCore
|
||||
|
||||
|
||||
Reference in New Issue
Block a user