Browse Source

Render passes mention multiview and texture views.

bjorn 2 years ago
parent
commit
a6c846e947
2 changed files with 9 additions and 2 deletions
  1. 1 1
      api/init.lua
  2. 8 1
      api/lovr/graphics/getPass.lua

+ 1 - 1
api/init.lua

@@ -17738,7 +17738,7 @@ return {
           description = "Creates and returns a temporary Pass object.",
           key = "lovr.graphics.getPass",
           module = "lovr.graphics",
-          notes = "Fun facts about render passes:\n\n- Textures must have the same dimensions, layer counts, and sample counts.\n- Textures must have been created with the `render` `TextureUsage`.\n- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.\n- It's okay to have zero color textures, but in this case there must be a depth texture.\n- Setting `clear` to `false` for textures is usually very slow on mobile GPUs.\n\nFor `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel.  This means that writing to the same element of a buffer twice, or writing to it and reading from it again is not guaranteed to work properly on all GPUs.  LÖVR is not currently able to check for this.  If compute or transfers need to be sequenced, multiple passes should be used.  It is, however, completely fine to read and write to non-overlapping regions of the same buffer or texture.",
+          notes = "Fun facts about render passes:\n\n- Textures must have been created with the `render` `TextureUsage`.\n- Textures must have the same dimensions, layer counts, and sample counts.\n- When rendering to textures with multiple layers, each draw will be broadcast to all layers.\n  Render passes have multiple \"views\" (cameras), and each layer uses a corresponding view,\n  allowing each layer to be rendered from a different viewpoint.  This enables fast stereo\n  rendering, but can also be used to efficiently render to cubemaps.  The `ViewIndex` variable\n  can also be used in shaders to set up any desired per-view behavior.\n- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.\n- It's okay to have zero color textures, but in this case there must be a depth texture.\n- Setting `clear` to `false` for textures is usually very slow on mobile GPUs.\n- It's possible to render to a specific mipmap level of a Texture, or a subset of its layers, by\n  rendering to texture views, see `Texture:newView`.\n\nFor `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel.  This means that writing to the same element of a buffer twice, or writing to it and reading from it again is not guaranteed to work properly on all GPUs.  LÖVR is not currently able to check for this.  If compute or transfers need to be sequenced, multiple passes should be used.  It is, however, completely fine to read and write to non-overlapping regions of the same buffer or texture.",
           related = {
             "lovr.graphics.submit",
             "lovr.graphics.getWindowPass",

+ 8 - 1
api/lovr/graphics/getPass.lua

@@ -113,11 +113,18 @@ return {
   notes = [[
     Fun facts about render passes:
 
-    - Textures must have the same dimensions, layer counts, and sample counts.
     - Textures must have been created with the `render` `TextureUsage`.
+    - Textures must have the same dimensions, layer counts, and sample counts.
+    - When rendering to textures with multiple layers, each draw will be broadcast to all layers.
+      Render passes have multiple "views" (cameras), and each layer uses a corresponding view,
+      allowing each layer to be rendered from a different viewpoint.  This enables fast stereo
+      rendering, but can also be used to efficiently render to cubemaps.  The `ViewIndex` variable
+      can also be used in shaders to set up any desired per-view behavior.
     - If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.
     - It's okay to have zero color textures, but in this case there must be a depth texture.
     - Setting `clear` to `false` for textures is usually very slow on mobile GPUs.
+    - It's possible to render to a specific mipmap level of a Texture, or a subset of its layers, by
+      rendering to texture views, see `Texture:newView`.
 
     For `compute` and `transfer` passes, all of the commands in the pass act as though they run in
     parallel.  This means that writing to the same element of a buffer twice, or writing to it and