Pass

Edit

Pass objects are used to record commands for the GPU. Commands can be recorded by calling functions on the Pass. After recording a set of passes, they can be submitted for the GPU to process using lovr.graphics.submit.

Pass objects are temporary and only exist for a single frame. Once lovr.graphics.submit is called to end the frame, any passes that were created during that frame become invalid. Each frame, a new set of passes must be created and recorded. LÖVR tries to detect if you use a pass after it's invalid, but this error checking is not 100% accurate at the moment.

There are 3 types of passes. Each type can record a specific type of command:

Constructors

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

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.
Pass:fillDraw a fullscreen triangle.
Pass:lineDraw a line.
Pass:meshDraw a mesh.
Pass:planeDraw a plane.
Pass:pointsDraw points.
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 drawing happens.

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:setFontSet the font.
Pass:setMaterialSet the material.
Pass:setMeshModeChange the way vertices are connected together.
Pass:setSamplerSet the sampler.
Pass:setScissorSet the scissor rectangle.
Pass:setShaderSet the active Shader.
Pass:setStencilTestConfigure the stencil test.
Pass:setStencilWriteSet whether draws write to the stencil buffer.
Pass:setViewportSet the viewport.
Pass:setWindingSet the winding direction of triangle vertices.
Pass:setWireframeEnable or disable wireframe rendering.

Shader Variables

Pass:sendSet the value of a shader variable.

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:setViewPoseSet the camera pose.

Compute

Pass:computeRun a compute shader.

Transfers

Pass:blitCopy data between textures with scaling.
Pass:clearClear a Buffer or Texture.
Pass:copyCopy data to or between GPU resources.
Pass:mipmapGenerate mipmaps for a texture.
Pass:readDownload data from a GPU resource.

Tallies

Pass:tickStart a GPU measurement.
Pass:tockStop a GPU measurement.

Miscellaneous

Pass:getClearReturn the clear values of the Pass.
Pass:getDimensionsGet the texture dimensions of a render pass.
Pass:getHeightGet the texture height of a render pass.
Pass:getSampleCountGet the antialiasing setting of a render pass.
Pass:getTargetGet the textures a render pass is rendering to.
Pass:getTypeGet the type of the Pass.
Pass:getWidthGet the texture width of a render pass.

See also