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); }
void BGI_startServer(int width, int height, int mode) { int pc; TCHAR fileName[128]; window.width = width; window.height = height; window.mode = mode; sharedObjects.clientPresentMutex = IPC_createMutex(CLIENT_PRESENT_MUTEX_NAME, TRUE); sharedObjects.serverCreatedEvent = IPC_createEvent(SERVER_STARTED_EVENT_NAME); if(mode & MODE_RELEASE) { CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)serverThread, (LPVOID)packParams(width, height, mode), 0, 0); } else { PROCESS_INFORMATION pi; BOOL r; STARTUPINFO si; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); GetModuleFileName(GetModuleHandle(NULL), fileName, sizeof(fileName) / sizeof(char)); r = CreateProcess(fileName, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL, NULL, &si, &pi); CreateRemoteThread(pi.hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)&BGI_server, (LPVOID)packParams(width, height, mode), 0, 0); } IPC_waitEvent(sharedObjects.serverCreatedEvent); window.wnd = FindWindow(WINDOW_CLASS_NAME, NULL); window.dc = GetDC(window.wnd); openSharedObjects(); if(mode & MODE_RELEASE) serverCheckerThread = NULL; else serverCheckerThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)serverPresenceChecker, NULL, 0, NULL); for(pc = 0; pc != 2; pc++) BGI_createPage(pages + pc, window.dc,sharedObjects.pagesSection[pc], width, height, mode & MODE_RGB); }
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); }
void LLTransferSource::sendTransferStatus(LLTSCode status) { gMessageSystem->newMessage("TransferInfo"); gMessageSystem->nextBlock("TransferInfo"); gMessageSystem->addUUID("TransferID", getID()); gMessageSystem->addS32("TargetType", LLTTT_UNKNOWN); gMessageSystem->addS32("ChannelType", mChannelp->getChannelType()); gMessageSystem->addS32("Status", status); gMessageSystem->addS32("Size", mSize); U8 tmp[MAX_PARAMS_SIZE]; LLDataPackerBinaryBuffer dp(tmp, MAX_PARAMS_SIZE); packParams(dp); S32 len = dp.getCurrentSize(); gMessageSystem->addBinaryData("Params", tmp, len); gMessageSystem->sendReliable(mChannelp->getHost()); // Abort if there was as asset system issue. if (status != LLTS_OK) { completionCallback(status); mChannelp->deleteTransfer(this); } }