Pass
EditPass 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:
render
passes render graphics to textures.compute
passes run compute shaders.transfer
passes can transfer data to/from GPU objects, likeBuffer
andTexture
.
Constructors
lovr.graphics.getPass | Get a temporary Pass. |
lovr.graphics.getWindowPass | Get the window pass. |
lovr.headset.getPass | Get a Pass that renders to the headset. |
Drawing
Draw objects and shapes.
Pass:box | Draw a box. |
Pass:capsule | Draw a capsule. |
Pass:circle | Draw a circle. |
Pass:cone | Draw a cone. |
Pass:cube | Draw a cube. |
Pass:cylinder | Draw a cylinder. |
Pass:draw | Draw a model. |
Pass:fill | Draw a fullscreen triangle. |
Pass:line | Draw a line. |
Pass:mesh | Draw a mesh. |
Pass:plane | Draw a plane. |
Pass:points | Draw points. |
Pass:skybox | Draw a skybox. |
Pass:sphere | Draw a sphere. |
Pass:text | Draw text. |
Pass:torus | Draw a donut. |
Coordinate System
Manipulate the 3D coordinate system.
Pass:origin | Reset the transform to the origin. |
Pass:pop | Pop one of the stacks. |
Pass:push | Push state onto a stack. |
Pass:rotate | Rotate the coordinate system. |
Pass:scale | Scale the coordinate system. |
Pass:transform | Apply a general transform to the coordinate system. |
Pass:translate | Translate the coordinate system. |
Render States
Set render states that change the way drawing happens.
Pass:setAlphaToCoverage | Enable or disable alpha to coverage. |
Pass:setBlendMode | Set the blend mode. |
Pass:setColor | Set the color. |
Pass:setColorWrite | Change the color channels affected by drawing. |
Pass:setCullMode | Control triangle face culling. |
Pass:setDepthClamp | Enable or disable depth clamp. |
Pass:setDepthOffset | Configure the depth offset. |
Pass:setDepthTest | Configure the depth test. |
Pass:setDepthWrite | Set whether draws write to the depth buffer. |
Pass:setFont | Set the font. |
Pass:setMaterial | Set the material. |
Pass:setMeshMode | Change the way vertices are connected together. |
Pass:setSampler | Set the sampler. |
Pass:setScissor | Set the scissor rectangle. |
Pass:setShader | Set the active Shader. |
Pass:setStencilTest | Configure the stencil test. |
Pass:setStencilWrite | Set whether draws write to the stencil buffer. |
Pass:setViewport | Set the viewport. |
Pass:setWinding | Set the winding direction of triangle vertices. |
Pass:setWireframe | Enable or disable wireframe rendering. |
Shader Variables
Pass:send | Set the value of a shader variable. |
Camera
Pass:getProjection | Get the field of view. |
Pass:getViewCount | Returns the view count of a render pass. |
Pass:getViewPose | Get the camera pose. |
Pass:setProjection | Set the field of view. |
Pass:setViewPose | Set the camera pose. |
Compute
Pass:compute | Run a compute shader. |
Transfers
Pass:blit | Copy data between textures with scaling. |
Pass:clear | Clear a Buffer or Texture. |
Pass:copy | Copy data to or between GPU resources. |
Pass:mipmap | Generate mipmaps for a texture. |
Pass:read | Download data from a GPU resource. |
Tallies
Pass:tick | Start a GPU measurement. |
Pass:tock | Stop a GPU measurement. |
Miscellaneous
Pass:getClear | Return the clear values of the Pass. |
Pass:getDimensions | Get the texture dimensions of a render pass. |
Pass:getHeight | Get the texture height of a render pass. |
Pass:getSampleCount | Get the antialiasing setting of a render pass. |
Pass:getTarget | Get the textures a render pass is rendering to. |
Pass:getType | Get the type of the Pass. |
Pass:getWidth | Get the texture width of a render pass. |