MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / BeginPass

Method BeginPass

engine/PoseidonGL33/EngineGL33_Queue.cpp:303–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void EngineGL33::BeginPass(PassId passId)
304{
305 if (IsIn3DPass())
306 {
307 LOG_DEBUG(Graphics, "GL33: BeginPass({}) already in 3D (passId={}), just updating", static_cast<int>(passId),
308 static_cast<int>(_activePassId));
309 if (_activePassId != passId)
310 SwitchPassDebugGroup(PassIdName(passId));
311 _activePassId = passId;
312 return;
313 }
314 LOG_DEBUG(Graphics, "GL33: BeginPass({}) from ScreenSpace — FULL INIT", static_cast<int>(passId));
315 FlushAndFreeAllQueues(_queueNo);
316 SwitchPassDebugGroup(PassIdName(passId));
317 _activePassId = passId;
318
319 SelectVertexShader(VSTransform);
320 // BeginPass bootstraps the 3D pass through the normal mesh shader before
321 // the first descriptor-owned draw. If the previous 3D draw had the same
322 // descriptor as the first draw in this pass (for example two shadow
323 // markers separated by a screen pass), ApplyPipeline would otherwise skip
324 // and leave VSTransform paired with PSShadow.
325 InvalidatePipelineCache();
326
327 // D3D convention: CW = front face. With glClipControl(GL_LOWER_LEFT),
328 // no viewport Y-flip occurs, so mesh winding is preserved from NDC to window.
329 Poseidon::render::cull::Back();
330 Poseidon::render::cull::FrontFaceCW();
331 Poseidon::render::pipeline::EnableDepthTest();
332 Poseidon::render::pipeline::DisableDepthClamp();
333 // Colour writes are RGBA for the whole 3D pass. ApplyPipeline no longer
334 // toggles the colour mask per draw (nothing disables it now), so assert
335 // it once here to keep the invariant load-bearing rather than implicit.
336 Poseidon::render::pipeline::SetColorMask(true);
337
338 if (GScene)
339 {
340 _frameState = BuildFrameState(GScene->GetCamera(), GScene->MainLight(), _bias, _fogColor, _sunEnabled);
341 _drawItems.clear();
342 _currentDrawItem = DrawItem{};
343
344 UploadFrameConstants(_frameState);
345 // Bind the (previous frame's) shadow depth map + light-VP for the lit
346 // shaders. No-op until a depth pass has run with shadow maps enabled.
347 UpdateShadowMapLitState();
348 }
349
350 // Crop the 3D scene to the AspectSettings world rect (pillarbox /
351 // manual noodle). No-op when the rect is full.
352 ApplyWorldViewport();
353}
354
355void EngineGL33::BeginScreenPass()
356{

Callers

nothing calls this directly

Calls 9

PassIdNameFunction · 0.85
BackFunction · 0.85
FrontFaceCWFunction · 0.85
EnableDepthTestFunction · 0.85
DisableDepthClampFunction · 0.85
SetColorMaskFunction · 0.85
GetCameraMethod · 0.80
MainLightMethod · 0.80
clearMethod · 0.80

Tested by

no test coverage detected