Pass

Edit

Pass objects record work for the GPU. They contain a list of things to draw and a list of compute shaders to run.

Methods like Pass:sphere will "record" a draw on the Pass, which adds it to the list. Other methods like Pass:setBlendMode or Pass:setShader will change the way the next draws are processed.

Once all of the work has been recorded to a Pass, it can be sent to the GPU using lovr.graphics.submit, which will start processing all of the compute work and draws (in that order).

A Pass can have a canvas, which is a set of textures that the draws will render to.

Pass:reset is used to clear all of the computes and draws, putting the Pass in a fresh state.

lovr.draw is called every frame with a Pass that is configured to render to either the headset or the window. The Pass will automatically get submitted afterwards.

Constructors

lovr.graphics.newPassCreate a new Pass.
lovr.graphics.getWindowPassGet the window pass.
lovr.headset.getPassGet a Pass that renders to the headset.
lovr.graphics.getPassGet a temporary Pass.

Drawing

Draw objects and shapes.

Pass:boxDraw a box.
Pass:capsuleDraw a capsule.
Pass:circleDraw a circle.
Pass:coneDraw a cone.
Pass:cubeDraw a cube.
Pass:cylinderDraw a cylinder.
Pass:drawDraw a Model, Mesh, or Texture.
Pass:fillDraw a fullscreen triangle.
Pass:lineDraw a line.
Pass:meshDraw a mesh.
Pass:planeDraw a plane.
Pass:pointsDraw points.
Pass:polygonDraw a polygon.
Pass:roundrectDraw a rounded rectangle.
Pass:skyboxDraw a skybox.
Pass:sphereDraw a sphere.
Pass:textDraw text.
Pass:torusDraw a donut.

Coordinate System

Manipulate the 3D coordinate system.

Pass:originReset the transform to the origin.
Pass:popPop one of the stacks.
Pass:pushPush state onto a stack.
Pass:rotateRotate the coordinate system.
Pass:scaleScale the coordinate system.
Pass:transformApply a general transform to the coordinate system.
Pass:translateTranslate the coordinate system.

Render States

Set render states that change the way draws appear. Render states can be saved and restored using Pass:push and Pass:pop.

Pass:setAlphaToCoverageEnable or disable alpha to coverage.
Pass:setBlendModeSet the blend mode.
Pass:setColorSet the color.
Pass:setColorWriteChange the color channels affected by drawing.
Pass:setCullModeControl triangle face culling.
Pass:setDepthClampEnable or disable depth clamp.
Pass:setDepthOffsetConfigure the depth offset.
Pass:setDepthTestConfigure the depth test.
Pass:setDepthWriteSet whether draws write to the depth buffer.
Pass:setFaceCullControl triangle face culling.
Pass:setFontSet the font.
Pass:setMaterialSet the material.
Pass:setMeshModeChange the way vertices are connected together.
Pass:setSamplerSet the sampler.
Pass:setStencilTestConfigure the stencil test.
Pass:setStencilWriteSet whether draws write to the stencil buffer.
Pass:setViewCullEnable or disable view frustum culling.
Pass:setWindingSet the winding direction of triangle vertices.
Pass:setWireframeEnable or disable wireframe rendering.

Shaders

Change the shader used for draws or computes, and set variables in the active shader.

Pass:sendSet the value of a shader variable.
Pass:setShaderSet the active Shader.

Compute

Pass:barrierSynchronize compute work.
Pass:computeRun a compute shader.

Tally

Tallies count the number of pixels that were visible for a draw.

Pass:beginTallyBegin a tally.
Pass:finishTallyFinish a tally.
Pass:getTallyBufferGet the Buffer that tally results will be written to.
Pass:setTallyBufferSet the Buffer that tally results will be written to.

Camera

Pass:getProjectionGet the field of view.
Pass:getViewCountReturns the view count of a render pass.
Pass:getViewPoseGet the camera pose.
Pass:setProjectionSet the field of view.
Pass:setScissorSet the scissor rectangle.
Pass:setViewPoseSet the camera pose.
Pass:setViewportSet the viewport.

Canvas

Pass:getCanvasGet the Pass's canvas.
Pass:getClearReturn the clear values of the Pass.
Pass:getDimensionsGet the dimensions of the Pass's canvas.
Pass:getHeightGet the height of the Pass's canvas.
Pass:getSampleCountGet the antialiasing setting of a render pass.
Pass:getTargetGet the textures a render pass is rendering to.
Pass:getWidthGet the width of the Pass's canvas.
Pass:setCanvasSet the Pass's canvas.
Pass:setClearSet the clear values of the Pass.

Miscellaneous

Pass:getLabelGet the debug label of the Pass.
Pass:getStatsGet statistics for the Pass.
Pass:getTypeGet the type of the Pass.
Pass:resetReset the Pass.

See also