Commit a1c72423 by Luc Ferron Committed by Commit Bot

Vulkan: Implement PACK_STATE dirty bit and remove warning

- also enables all dEQP tests for functional.read_pixels.* Bug: angleproject:2480 Change-Id: Ib7bcd6b046ff8b0ecf110e70f735036bedf17902 Reviewed-on: https://chromium-review.googlesource.com/1058149 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 21386a34
......@@ -520,7 +520,8 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits
WARN() << "DIRTY_BIT_UNPACK_BUFFER_BINDING unimplemented";
break;
case gl::State::DIRTY_BIT_PACK_STATE:
WARN() << "DIRTY_BIT_PACK_STATE unimplemented";
// This is a no-op, its only important to use the right pack state when we do
// call readPixels later on.
break;
case gl::State::DIRTY_BIT_PACK_BUFFER_BINDING:
WARN() << "DIRTY_BIT_PACK_BUFFER_BINDING unimplemented";
......
......@@ -38,7 +38,7 @@ const gl::InternalFormat &GetReadAttachmentInfo(const gl::Context *context,
renderTarget->image->getFormat().textureFormat().fboImplementationInternalFormat;
return gl::GetSizedInternalFormatInfo(implFormat);
}
} // anonymous namespace
} // anonymous namespace<
// static
FramebufferVk *FramebufferVk::CreateUserFBO(const gl::FramebufferState &state)
......@@ -276,12 +276,33 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
GLenum type,
void *pixels)
{
// Clip read area to framebuffer.
const gl::Extents &fbSize = getState().getReadAttachment()->getSize();
const gl::Rectangle fbRect(0, 0, fbSize.width, fbSize.height);
gl::Rectangle clippedArea;
if (!ClipRectangle(area, fbRect, &clippedArea))
{
// nothing to read
return gl::NoError();
}
const gl::State &glState = context->getGLState();
RenderTargetVk *renderTarget = getColorReadRenderTarget();
ASSERT(renderTarget);
const angle::Format &angleFormat = renderTarget->image->getFormat().textureFormat();
GLuint outputPitch = angleFormat.pixelBytes * area.width;
const gl::PixelPackState &packState = context->getGLState().getPackState();
const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(format, type);
GLuint outputPitch = 0;
ANGLE_TRY_RESULT(
sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, packState.rowLength),
outputPitch);
GLuint outputSkipBytes = 0;
ANGLE_TRY_RESULT(sizedFormatInfo.computeSkipBytes(outputPitch, 0, packState, false),
outputSkipBytes);
outputSkipBytes += (clippedArea.x - area.x) * sizedFormatInfo.pixelBytes +
(clippedArea.y - area.y) * outputPitch;
PackPixelsParams params;
params.area = area;
......@@ -293,7 +314,8 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(beginWriteResource(vk::GetImpl(context)->getRenderer(), &commandBuffer));
return ReadPixelsFromRenderTarget(context, area, params, renderTarget, commandBuffer, pixels);
return ReadPixelsFromRenderTarget(context, clippedArea, params, renderTarget, commandBuffer,
reinterpret_cast<uint8_t *>(pixels) + outputSkipBytes);
}
RenderTargetVk *FramebufferVk::getColorReadRenderTarget()
......
......@@ -283,7 +283,6 @@
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_partial.multiple_basic_array.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.unused_uniforms.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.random.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.read_pixels.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.dither.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.state_query.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.clipping.* = 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