mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Add validations to the texture copies with BC formats
This patch adds the validation on the texture copies with BC formats. 1. BufferCopyView.offset in B2T and T2B copies must be a multiple of the compressed texel block size in bytes. 2. BufferCopyView.rowPitch in B2T and T2B copies refers to the number of bytes from the start of one row of blocks to the start of the next row of blocks. 3. BufferCopyView.imageHeight must be a multiple of the compressed texel block height (4 for BC formats). 4. All members in TextureCopyView.origin must be a multiple of the corresponding dimensions of the compressed texel block (4x4x1 for BC formats). 5. All the mumbers in 'copySize' must be a multiple of the corresponding dimensions of the compressed texel block (4x4x1 for BC formats) because D3D12 requires the width and height of a texture in BC formats must be multiples of 4. 6. Compute the texture size in non-zero mipmap levels with paddings for textures in BC formats when necessary. BUG=dawn:42 TEST=dawn_unittests Change-Id: Iac8d6c93ab8b37bb46becffd4175339722ab6016 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7860 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
8f4046b0b6
commit
872c1d7fe9
@@ -171,7 +171,7 @@ namespace dawn_native { namespace opengl {
|
||||
|
||||
if (GetDevice()->IsToggleEnabled(Toggle::NonzeroClearResourcesOnCreationForTesting)) {
|
||||
static constexpr uint32_t MAX_TEXEL_SIZE = 16;
|
||||
ASSERT(TextureFormatPixelSize(GetFormat()) <= MAX_TEXEL_SIZE);
|
||||
ASSERT(TextureFormatTexelBlockSizeInBytes(GetFormat()) <= MAX_TEXEL_SIZE);
|
||||
GLubyte clearColor[MAX_TEXEL_SIZE];
|
||||
std::fill(clearColor, clearColor + MAX_TEXEL_SIZE, 255);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user