Implement BufferCopyView.imageHeight Parameter

Implement BufferCopyView.imageHeight Parameter. Adds validation tests.
Adequate functional testing not possible without 3D texture support.

Bug: dawn:48
Change-Id: I00e4464eb451c948dee2890a11fb0984eff681a0
Reviewed-on: https://dawn-review.googlesource.com/c/2980
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones
2018-12-11 09:48:36 +00:00
committed by Commit Bot service account
parent a49242766a
commit d86edb310a
9 changed files with 144 additions and 44 deletions

View File

@@ -333,6 +333,7 @@ namespace dawn_native { namespace opengl {
glPixelStorei(GL_UNPACK_ROW_LENGTH,
src.rowPitch / TextureFormatPixelSize(texture->GetFormat()));
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, src.imageHeight);
switch (texture->GetDimension()) {
case dawn::TextureDimension::e2D:
if (texture->GetArrayLayers() > 1) {
@@ -352,6 +353,7 @@ namespace dawn_native { namespace opengl {
UNREACHABLE();
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
} break;
@@ -393,11 +395,13 @@ namespace dawn_native { namespace opengl {
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer->GetHandle());
glPixelStorei(GL_PACK_ROW_LENGTH,
dst.rowPitch / TextureFormatPixelSize(texture->GetFormat()));
glPixelStorei(GL_PACK_IMAGE_HEIGHT, dst.imageHeight);
ASSERT(copySize.depth == 1 && src.origin.z == 0);
void* offset = reinterpret_cast<void*>(static_cast<uintptr_t>(dst.offset));
glReadPixels(src.origin.x, src.origin.y, copySize.width, copySize.height,
format.format, format.type, offset);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
glDeleteFramebuffers(1, &readFBO);