mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Adding Queue::WriteTexture
Added Queue::WriteTexture with validation but no actual implementation. Tests were mostly taken from validation tests for copying buffer to texture. Validation tests for CopyB2T and WriteTexture do not cover 2d-array textures yet. Bug: dawn:483 Change-Id: I9027eb615c02fe2265cde912f6ba17a235b94728 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24440 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Tomek Ponitka <tommek@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
83fe1bc34d
commit
a9c7d64aad
@@ -417,4 +417,51 @@ namespace utils {
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
// TODO(jiawei.shao@intel.com): support more pixel formats
|
||||
uint32_t TextureFormatPixelSize(wgpu::TextureFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::TextureFormat::RG8Unorm:
|
||||
return 2;
|
||||
case wgpu::TextureFormat::RGBA8Unorm:
|
||||
return 4;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const std::array<wgpu::TextureFormat, 14> kBCFormats = {
|
||||
wgpu::TextureFormat::BC1RGBAUnorm, wgpu::TextureFormat::BC1RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC2RGBAUnorm, wgpu::TextureFormat::BC2RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC3RGBAUnorm, wgpu::TextureFormat::BC3RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC4RUnorm, wgpu::TextureFormat::BC4RSnorm,
|
||||
wgpu::TextureFormat::BC5RGUnorm, wgpu::TextureFormat::BC5RGSnorm,
|
||||
wgpu::TextureFormat::BC6HRGBUfloat, wgpu::TextureFormat::BC6HRGBSfloat,
|
||||
wgpu::TextureFormat::BC7RGBAUnorm, wgpu::TextureFormat::BC7RGBAUnormSrgb};
|
||||
|
||||
uint32_t CompressedFormatBlockSizeInBytes(wgpu::TextureFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::TextureFormat::BC1RGBAUnorm:
|
||||
case wgpu::TextureFormat::BC1RGBAUnormSrgb:
|
||||
case wgpu::TextureFormat::BC4RSnorm:
|
||||
case wgpu::TextureFormat::BC4RUnorm:
|
||||
return 8;
|
||||
case wgpu::TextureFormat::BC2RGBAUnorm:
|
||||
case wgpu::TextureFormat::BC2RGBAUnormSrgb:
|
||||
case wgpu::TextureFormat::BC3RGBAUnorm:
|
||||
case wgpu::TextureFormat::BC3RGBAUnormSrgb:
|
||||
case wgpu::TextureFormat::BC5RGSnorm:
|
||||
case wgpu::TextureFormat::BC5RGUnorm:
|
||||
case wgpu::TextureFormat::BC6HRGBSfloat:
|
||||
case wgpu::TextureFormat::BC6HRGBUfloat:
|
||||
case wgpu::TextureFormat::BC7RGBAUnorm:
|
||||
case wgpu::TextureFormat::BC7RGBAUnormSrgb:
|
||||
return 16;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -151,6 +151,10 @@ namespace utils {
|
||||
uint32_t mipmapLevel,
|
||||
uint32_t rowsPerImage);
|
||||
|
||||
uint32_t TextureFormatPixelSize(wgpu::TextureFormat format);
|
||||
extern const std::array<wgpu::TextureFormat, 14> kBCFormats;
|
||||
uint32_t CompressedFormatBlockSizeInBytes(wgpu::TextureFormat format);
|
||||
|
||||
} // namespace utils
|
||||
|
||||
#endif // UTILS_DAWNHELPERS_H_
|
||||
|
||||
Reference in New Issue
Block a user