Commit dc2c5c5a by Ian Elliott Committed by Commit Bot

Vulkan: Initial Implementation of PBO support (software only)

This contains support for both pixel unpack buffers (i.e. for glTex*Image*) and pixel pack buffers (i.e. for glReadPixels). Bug: angleproject:3209 Bug: angleproject:3210 Change-Id: I077cccbffb96fb5f0198922bc7c1850a7eb3f616 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1723096 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 8a43b8c7
...@@ -1515,8 +1515,24 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk, ...@@ -1515,8 +1515,24 @@ angle::Result FramebufferVk::readPixelsImpl(ContextVk *contextVk,
// created with the host coherent bit. // created with the host coherent bit.
ANGLE_TRY(mReadPixelBuffer.invalidate(contextVk)); ANGLE_TRY(mReadPixelBuffer.invalidate(contextVk));
PackPixels(packPixelsParams, *readFormat, area.width * readFormat->pixelBytes, readPixelBuffer, const gl::State &glState = contextVk->getState();
static_cast<uint8_t *>(pixels)); gl::Buffer *packBuffer = glState.getTargetBuffer(gl::BufferBinding::PixelPack);
if (packBuffer != nullptr)
{
// Must map the PBO in order to read its contents (and then unmap it later)
BufferVk *packBufferVk = vk::GetImpl(packBuffer);
void *mapPtr = nullptr;
ANGLE_TRY(packBufferVk->mapImpl(contextVk, &mapPtr));
uint8_t *dest = static_cast<uint8_t *>(mapPtr) + reinterpret_cast<ptrdiff_t>(pixels);
PackPixels(packPixelsParams, *readFormat, area.width * readFormat->pixelBytes,
readPixelBuffer, static_cast<uint8_t *>(dest));
packBufferVk->unmapImpl(contextVk);
}
else
{
PackPixels(packPixelsParams, *readFormat, area.width * readFormat->pixelBytes,
readPixelBuffer, static_cast<uint8_t *>(pixels));
}
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -235,9 +235,27 @@ angle::Result TextureVk::setSubImageImpl(const gl::Context *context, ...@@ -235,9 +235,27 @@ angle::Result TextureVk::setSubImageImpl(const gl::Context *context,
const uint8_t *pixels, const uint8_t *pixels,
const vk::Format &vkFormat) const vk::Format &vkFormat)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
const gl::State &glState = contextVk->getState();
gl::Buffer *unpackBuffer = glState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
if (unpackBuffer)
{
BufferVk *unpackBufferVk = vk::GetImpl(unpackBuffer);
void *mapPtr = nullptr;
ANGLE_TRY(unpackBufferVk->mapImpl(contextVk, &mapPtr));
const uint8_t *source =
static_cast<const uint8_t *>(mapPtr) + reinterpret_cast<ptrdiff_t>(pixels);
if (pixels) ANGLE_TRY(mImage->stageSubresourceUpdate(
contextVk, getNativeImageIndex(index), gl::Extents(area.width, area.height, area.depth),
gl::Offset(area.x, area.y, area.z), formatInfo, unpack, type, source, vkFormat));
unpackBufferVk->unmapImpl(contextVk);
onStagingBufferChange();
}
else if (pixels)
{ {
ANGLE_TRY(mImage->stageSubresourceUpdate( ANGLE_TRY(mImage->stageSubresourceUpdate(
contextVk, getNativeImageIndex(index), gl::Extents(area.width, area.height, area.depth), contextVk, getNativeImageIndex(index), gl::Extents(area.width, area.height, area.depth),
......
...@@ -2159,7 +2159,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk, ...@@ -2159,7 +2159,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
ANGLE_TRY(mStagingBuffer.allocate(contextVk, allocationSize, &stagingPointer, &bufferHandle, ANGLE_TRY(mStagingBuffer.allocate(contextVk, allocationSize, &stagingPointer, &bufferHandle,
&stagingOffset, nullptr)); &stagingOffset, nullptr));
const uint8_t *source = pixels + inputSkipBytes; const uint8_t *source = pixels + static_cast<ptrdiff_t>(inputSkipBytes);
LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(type); LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(type);
......
...@@ -555,17 +555,8 @@ ...@@ -555,17 +555,8 @@
3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_* = FAIL 3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_unpack_params.r8_* = FAIL
// Pixel Buffer Objects (PBOs): // Pixel Buffer Objects (PBOs):
3210 VULKAN : dEQP-GLES3.functional.pbo.* = SKIP 3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_pbo.rgb8_skip_images* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage2d_pbo.* = FAIL 3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_pbo.rgb8_skip_images* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage2d_pbo.rgb8_* = SKIP
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_pbo.* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_pbo.rgb8_* = SKIP
3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage2d_pbo.* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage2d_pbo.rgb8_* = SKIP
3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_pbo.* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_pbo.rgb8_* = SKIP
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage2d_depth_pbo.* = FAIL
3209 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_depth_pbo.* = SKIP
// Formats: // Formats:
3677 ANDROID VULKAN : dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.rgba32f = FAIL 3677 ANDROID VULKAN : dEQP-GLES3.functional.fbo.completeness.renderable.renderbuffer.color0.rgba32f = FAIL
...@@ -586,6 +577,8 @@ ...@@ -586,6 +577,8 @@
2905 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage2d_depth.depth32f_stencil8 = FAIL 2905 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage2d_depth.depth32f_stencil8 = FAIL
2905 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth32f_stencil8_2d_array = FAIL 2905 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth32f_stencil8_2d_array = FAIL
2905 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_depth.depth32f_stencil8_2d_array = FAIL 2905 VULKAN : dEQP-GLES3.functional.texture.specification.texsubimage3d_depth.depth32f_stencil8_2d_array = FAIL
2905 VULKAN : dEQP-GLES3.functional.texture.specification.teximage2d_depth_pbo.depth32f_stencil8 = FAIL
2905 VULKAN : dEQP-GLES3.functional.texture.specification.teximage3d_depth_pbo.depth32f_stencil8_2d_array = FAIL
// Shader support: // Shader support:
3219 VULKAN : dEQP-GLES3.functional.negative_api.shader.link_program = FAIL 3219 VULKAN : dEQP-GLES3.functional.negative_api.shader.link_program = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment