Deprecate BufferCopyView.rowPitch/imageHeight -> bytesPerRow/rowsPerImage

Bug: dawn:22

Change-Id: Ib4d93a73a6c40326d180f569fd51216c2d87df1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20201
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez
2020-04-24 10:02:43 +00:00
committed by Commit Bot service account
parent c244f53921
commit cdf2d8de77
29 changed files with 505 additions and 301 deletions

View File

@@ -286,17 +286,17 @@ namespace dawn_native { namespace opengl {
} else {
// TODO(natlee@microsoft.com): test compressed textures are cleared
// create temp buffer with clear color to copy to the texture image
ASSERT(kTextureRowPitchAlignment % GetFormat().blockByteSize == 0);
uint32_t rowPitch =
ASSERT(kTextureBytesPerRowAlignment % GetFormat().blockByteSize == 0);
uint32_t bytesPerRow =
Align((GetSize().width / GetFormat().blockWidth) * GetFormat().blockByteSize,
kTextureRowPitchAlignment);
kTextureBytesPerRowAlignment);
// Make sure that we are not rounding
ASSERT(rowPitch % GetFormat().blockByteSize == 0);
ASSERT(bytesPerRow % GetFormat().blockByteSize == 0);
ASSERT(GetSize().height % GetFormat().blockHeight == 0);
dawn_native::BufferDescriptor descriptor;
descriptor.size = rowPitch * (GetSize().height / GetFormat().blockHeight);
descriptor.size = bytesPerRow * (GetSize().height / GetFormat().blockHeight);
if (descriptor.size > std::numeric_limits<uint32_t>::max()) {
return DAWN_OUT_OF_MEMORY_ERROR("Unable to allocate buffer.");
}
@@ -317,7 +317,7 @@ namespace dawn_native { namespace opengl {
// Bind buffer and texture, and make the buffer to texture copy
gl.PixelStorei(GL_UNPACK_ROW_LENGTH,
(rowPitch / GetFormat().blockByteSize) * GetFormat().blockWidth);
(bytesPerRow / GetFormat().blockByteSize) * GetFormat().blockWidth);
gl.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
for (GLint level = baseMipLevel; level < baseMipLevel + levelCount; ++level) {
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, srcBuffer->GetHandle());