MCPcopy Create free account
hub / github.com/ZDoom/Raze / RenderToSavePic

Function RenderToSavePic

source/core/rendering/hw_entrypoint.cpp:259–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259void RenderToSavePic(FRenderViewpoint& vp, FileWriter* file, int width, int height)
260{
261 IntRect bounds;
262 bounds.left = 0;
263 bounds.top = 0;
264 bounds.width = width;
265 bounds.height = height;
266 auto& RenderState = *screen->RenderState();
267
268 // we must be sure the GPU finished reading from the buffer before we fill it with new data.
269 screen->WaitForCommands(false);
270
271 // Switch to render buffers dimensioned for the savepic
272 screen->SetSaveBuffers(true);
273 screen->ImageTransitionScene(true);
274
275 RenderState.SetVertexBuffer(screen->mVertexData);
276 screen->mVertexData->Reset();
277 screen->mLights->Clear();
278 screen->mViewpoints->Clear();
279
280 twodpsp.Clear();
281
282 RenderViewpoint(vp, &bounds, vp.FieldOfView.Degrees(), 1.333f, 1.333f, true, false);
283
284
285 int numpixels = width * height;
286 TArray<uint8_t> scr(numpixels * 3, true);
287 screen->CopyScreenToBuffer(width, height, scr.Data());
288
289 DoWriteSavePic(file, scr.Data(), width, height, screen->FlipSavePic());
290
291 // Switch back the screen render buffers
292 screen->SetViewportRects(nullptr);
293 screen->SetSaveBuffers(false);
294}
295
296//===========================================================================
297//

Callers 1

render_drawroomsFunction · 0.85

Calls 14

RenderViewpointFunction · 0.85
DoWriteSavePicFunction · 0.85
DegreesMethod · 0.80
RenderStateMethod · 0.45
WaitForCommandsMethod · 0.45
SetSaveBuffersMethod · 0.45
ImageTransitionSceneMethod · 0.45
SetVertexBufferMethod · 0.45
ResetMethod · 0.45
ClearMethod · 0.45
CopyScreenToBufferMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected