Commit 60284223 by Luc Ferron Committed by Commit Bot

Vulkan: Support of npot textures

The bug was with the readPixels not using the rowPitch, and not really with the support of npot. Bug:angleproject:2413 Change-Id: I09c0d87768bc29d3beb452ae83996cd4d2b4a600 Reviewed-on: https://chromium-review.googlesource.com/971830Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Luc Ferron <lucferron@chromium.org>
parent 40b1c770
...@@ -308,17 +308,23 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context, ...@@ -308,17 +308,23 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
// TODO(jmadill): Use pixel bytes from the ANGLE format directly. // TODO(jmadill): Use pixel bytes from the ANGLE format directly.
const auto &glFormat = gl::GetSizedInternalFormatInfo(angleFormat.glInternalFormat); const auto &glFormat = gl::GetSizedInternalFormatInfo(angleFormat.glInternalFormat);
int inputPitch = glFormat.pixelBytes * area.width; int outputPitch = glFormat.pixelBytes * area.width;
// Get the staging image pitch and use it to pack the pixels later.
VkSubresourceLayout subresourceLayout;
stagingImage.getImage().getSubresourceLayout(device, VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
&subresourceLayout);
PackPixelsParams params; PackPixelsParams params;
params.area = area; params.area = area;
params.format = format; params.format = format;
params.type = type; params.type = type;
params.outputPitch = inputPitch; params.outputPitch = outputPitch;
params.packBuffer = glState.getTargetBuffer(gl::BufferBinding::PixelPack); params.packBuffer = glState.getTargetBuffer(gl::BufferBinding::PixelPack);
params.pack = glState.getPackState(); params.pack = glState.getPackState();
PackPixels(params, angleFormat, inputPitch, mapPointer, reinterpret_cast<uint8_t *>(pixels)); PackPixels(params, angleFormat, static_cast<int>(subresourceLayout.rowPitch), mapPointer,
reinterpret_cast<uint8_t *>(pixels));
stagingImage.getDeviceMemory().unmap(device); stagingImage.getDeviceMemory().unmap(device);
renderer->releaseObject(renderer->getCurrentQueueSerial(), &stagingImage); renderer->releaseObject(renderer->getCurrentQueueSerial(), &stagingImage);
......
...@@ -298,15 +298,10 @@ gl::Error TextureVk::setSubImageImpl(ContextVk *contextVk, ...@@ -298,15 +298,10 @@ gl::Error TextureVk::setSubImageImpl(ContextVk *contextVk,
const uint8_t *source = pixels + inputSkipBytes; const uint8_t *source = pixels + inputSkipBytes;
// Get the subresource layout. This has important parameters like row pitch. // Get the subresource layout. This has important parameters like row pitch.
// TODO(jmadill): Fill out this structure based on input parameters. // TODO(jmadill): Fill out these parameters based on input parameters.
VkImageSubresource subresource;
subresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
subresource.mipLevel = 0;
subresource.arrayLayer = 0;
VkSubresourceLayout subresourceLayout; VkSubresourceLayout subresourceLayout;
vkGetImageSubresourceLayout(device, stagingImage.getImage().getHandle(), &subresource, stagingImage.getImage().getSubresourceLayout(device, VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
&subresourceLayout); &subresourceLayout);
loadFunction.loadFunction(size.width, size.height, size.depth, source, inputRowPitch, loadFunction.loadFunction(size.width, size.height, size.depth, source, inputRowPitch,
inputDepthPitch, mapPointer, inputDepthPitch, mapPointer,
......
...@@ -757,6 +757,20 @@ Error Image::bindMemory(VkDevice device, const vk::DeviceMemory &deviceMemory) ...@@ -757,6 +757,20 @@ Error Image::bindMemory(VkDevice device, const vk::DeviceMemory &deviceMemory)
return NoError(); return NoError();
} }
void Image::getSubresourceLayout(VkDevice device,
VkImageAspectFlagBits aspectMask,
uint32_t mipLevel,
uint32_t arrayLayer,
VkSubresourceLayout *outSubresourceLayout)
{
VkImageSubresource subresource;
subresource.aspectMask = aspectMask;
subresource.mipLevel = mipLevel;
subresource.arrayLayer = arrayLayer;
vkGetImageSubresourceLayout(device, getHandle(), &subresource, outSubresourceLayout);
}
// ImageView implementation. // ImageView implementation.
ImageView::ImageView() ImageView::ImageView()
{ {
......
...@@ -431,6 +431,11 @@ class Image final : public WrappedObject<Image, VkImage> ...@@ -431,6 +431,11 @@ class Image final : public WrappedObject<Image, VkImage>
Error bindMemory(VkDevice device, const vk::DeviceMemory &deviceMemory); Error bindMemory(VkDevice device, const vk::DeviceMemory &deviceMemory);
VkImageLayout getCurrentLayout() const { return mCurrentLayout; } VkImageLayout getCurrentLayout() const { return mCurrentLayout; }
void getSubresourceLayout(VkDevice device,
VkImageAspectFlagBits aspectMask,
uint32_t mipLevel,
uint32_t arrayLayer,
VkSubresourceLayout *outSubresourceLayout);
void updateLayout(VkImageLayout layout) { mCurrentLayout = layout; } void updateLayout(VkImageLayout layout) { mCurrentLayout = layout; }
private: private:
......
...@@ -188,19 +188,12 @@ ...@@ -188,19 +188,12 @@
2161 VULKAN : dEQP-GLES2.functional.light_amount.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.light_amount.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.a8* = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.a8* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.l8_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.l8_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.l8_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.la88_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.la88_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.la88_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb565_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb565_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb565_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb888_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb888_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.rgb888_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba4444_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba4444_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba4444_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba5551_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba5551_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba5551_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba8888_2d_npot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba8888_cube_pot = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.format.rgba8888_cube_pot = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.size.2d.64x64_l8_mipmap = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.size.2d.64x64_l8_mipmap = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.size.2d.64x64_rgba4444_mipmap = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.size.2d.64x64_rgba4444_mipmap = SKIP
......
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