{{newin|[[0.10.0]]|100|type=function}}
Discards (trashes) the contents of the screen or active [[Canvas]]. This is a performance optimization function with niche use cases.

If the active Canvas has just been changed and the "replace" [[BlendMode]] is about to be used to draw something which covers the entire screen, calling [[love.graphics.discard]] rather than calling [[love.graphics.clear]] or doing nothing may improve performance on mobile devices.

On some desktop systems this function may do nothing.

{{notice|This function effectively replaces the contents of the screen or active Canvas with garbage. Most [[BlendMode]]s, including the default "alpha" blend mode, blend what's drawn with the contents of the screen - which would cause unexpected glitches if this function is used inappropriately.}}

== Function ==
=== Synopsis ===
<source lang="lua">
love.graphics.discard( discardcolor, discardstencil )
</source>
=== Arguments ===
{{param|boolean|discardcolor (true)|Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.)}}
{{param|boolean|discardstencil (true)|Whether to discard the contents of the [[love.graphics.stencil|stencil buffer]] of the screen / active Canvas.}}
=== Returns ===
Nothing.
== Function ==
=== Synopsis ===
<source lang="lua">
love.graphics.discard( discardcolors, discardstencil )
</source>
=== Arguments ===
{{param|table|discardcolors|An array containing boolean values indicating whether to discard the texture of each active Canvas, when multiple simultaneous Canvases are active.}}
{{param|boolean|discardstencil (true)|Whether to discard the contents of the [[love.graphics.stencil|stencil buffer]] of the screen / active Canvas.}}
=== Returns ===
Nothing.
== See Also ==
* [[parent::love.graphics]]
* [[love.graphics.clear]]
* [[Canvas]]
* [[love.graphics.setBlendMode]]
[[Category:Functions]]
[[Sub-Category::Drawing| ]]
{{#set:Description=Discards the contents of the screen or active [[Canvas]].}}
== Other Languages ==
{{i18n|love.graphics.discard}}