mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
Support BC5 formats on Vulkan
This patch supports BC5 formats on Vulkan backends and adds related Dawn end2end tests. For the textures with BC formats, they could have non-multiple-of-4 sizes on the non-zero mipmap levels in sampling, but we are still required to provide texture data in complete 4x4 blocks in texture copies because that is the size of which they are stored in GPU memory. In this patch, we refer the term "physical memory size" as the memory size of the texture subresource in GPU memory, and the term "virtual memory size" as the size used in texture sampling. As Dawn requires the Extent3D in texture copies must fit in the physical memory size, while Vulkan requires it must fit in the virtual memory size, this patch recalculates the imageExtent to ensure it always follow this Vulkan validation rules. For Dawn end2end tests, note that we use pure green and pure red for the textures because BC5 does not support SRGB formats. Furthermore, "CopyPartofTextureSubResourceIntoNonZeroMipmapLevel" is skipped in this patch because there is an issue on the T2T copies from a region within the virtual size of one texture to another one that exceeds the virtual size of another texture in Vulkan SPEC. BUG=dawn:42 TEST=dawn_end2end_tests Change-Id: I17518cd335fb13125cb753bbf879bc06eb20e426 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8260 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
c246494dbf
commit
72508d6d06
@@ -215,8 +215,6 @@ namespace utils {
|
||||
uint32_t height) {
|
||||
DAWN_ASSERT(width > 0 && height > 0);
|
||||
|
||||
dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size.width = width;
|
||||
@@ -224,13 +222,13 @@ namespace utils {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = kColorFormat;
|
||||
descriptor.format = BasicRenderPass::kDefaultColorFormat;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture color = device.CreateTexture(&descriptor);
|
||||
|
||||
return BasicRenderPass(width, height, color, kColorFormat);
|
||||
return BasicRenderPass(width, height, color);
|
||||
}
|
||||
|
||||
dawn::BufferCopyView CreateBufferCopyView(dawn::Buffer buffer,
|
||||
|
||||
@@ -73,7 +73,9 @@ namespace utils {
|
||||
BasicRenderPass(uint32_t width,
|
||||
uint32_t height,
|
||||
dawn::Texture color,
|
||||
dawn::TextureFormat texture);
|
||||
dawn::TextureFormat texture = kDefaultColorFormat);
|
||||
|
||||
static constexpr dawn::TextureFormat kDefaultColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
||||
Reference in New Issue
Block a user