gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &pack, uint8_t *pixels) const { const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment(); ASSERT(readAttachment); gl::Buffer *packBuffer = pack.pixelBuffer.get(); if (packBuffer != nullptr) { if (pack.rowLength != 0 || pack.skipRows != 0 || pack.skipPixels != 0) { UNIMPLEMENTED(); return gl::Error(GL_INVALID_OPERATION, "Unimplemented pixel store parameters in readPixelsImpl"); } Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer); PackPixelsParams packParams(area, format, type, static_cast<GLuint>(outputPitch), pack, reinterpret_cast<ptrdiff_t>(pixels)); return packBufferStorage->packPixels(*readAttachment, packParams); } return mRenderer->readFromAttachment(*readAttachment, area, format, type, static_cast<GLuint>(outputPitch), pack, pixels); }
gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &pack, uint8_t *pixels) const { ID3D11Texture2D *colorBufferTexture = nullptr; unsigned int subresourceIndex = 0; const gl::FramebufferAttachment *colorbuffer = mData.getReadAttachment(); ASSERT(colorbuffer); gl::Error error = getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture); if (error.isError()) { return error; } gl::Buffer *packBuffer = pack.pixelBuffer.get(); if (packBuffer != nullptr) { if (pack.rowLength != 0 || pack.skipRows != 0 || pack.skipPixels != 0) { UNIMPLEMENTED(); return gl::Error(GL_INVALID_OPERATION, "Unimplemented pixel store parameters in readPixelsImpl"); } Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer); PackPixelsParams packParams(area, format, type, static_cast<GLuint>(outputPitch), pack, reinterpret_cast<ptrdiff_t>(pixels)); error = packBufferStorage->packPixels(colorBufferTexture, subresourceIndex, packParams); if (error.isError()) { SafeRelease(colorBufferTexture); return error; } } else { error = mRenderer->readTextureData(colorBufferTexture, subresourceIndex, area, format, type, static_cast<GLuint>(outputPitch), pack, pixels); if (error.isError()) { SafeRelease(colorBufferTexture); return error; } } SafeRelease(colorBufferTexture); return gl::Error(GL_NO_ERROR); }
gl::Error Framebuffer11::readPixels(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &pack, uint8_t *pixels) const { ID3D11Texture2D *colorBufferTexture = NULL; unsigned int subresourceIndex = 0; const gl::FramebufferAttachment *colorbuffer = getReadAttachment(); ASSERT(colorbuffer); gl::Error error = getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture); if (error.isError()) { return error; } gl::Buffer *packBuffer = pack.pixelBuffer.get(); if (packBuffer != NULL) { Buffer11 *packBufferStorage = Buffer11::makeBuffer11(packBuffer->getImplementation()); PackPixelsParams packParams(area, format, type, outputPitch, pack, reinterpret_cast<ptrdiff_t>(pixels)); error = packBufferStorage->packPixels(colorBufferTexture, subresourceIndex, packParams); if (error.isError()) { SafeRelease(colorBufferTexture); return error; } packBuffer->getIndexRangeCache()->clear(); } else { error = mRenderer->readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch, pack, pixels); if (error.isError()) { SafeRelease(colorBufferTexture); return error; } } SafeRelease(colorBufferTexture); return gl::Error(GL_NO_ERROR); }
gl::Error Framebuffer11::readPixelsImpl(const gl::Rectangle &area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &pack, uint8_t *pixels) const { const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment(); ASSERT(readAttachment); gl::Buffer *packBuffer = pack.pixelBuffer.get(); if (packBuffer != nullptr) { Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer); PackPixelsParams packParams(area, format, type, static_cast<GLuint>(outputPitch), pack, reinterpret_cast<ptrdiff_t>(pixels)); return packBufferStorage->packPixels(*readAttachment, packParams); } return mRenderer->readFromAttachment(*readAttachment, area, format, type, static_cast<GLuint>(outputPitch), pack, pixels); }