Browse Source

Write about GPU devices;

unknown 3 years ago
parent
commit
57ae7ce258
3 changed files with 929 additions and 612 deletions
  1. 881 600
      api/init.lua
  2. 46 9
      api/lovr/graphics/getDevice.lua
  3. 2 3
      api/lovr/graphics/init.lua

File diff suppressed because it is too large
+ 881 - 600
api/init.lua


+ 46 - 9
api/lovr/graphics/getDevice.lua

@@ -1,47 +1,84 @@
 return {
   tag = 'graphics-misc',
-  summary = 'Get information about the current GPU.',
-  description = 'TODO',
+  summary = 'Get information about the graphics device and driver.',
+  description = 'Returns information about the graphics device and driver.',
   arguments = {},
   returns = {
     {
       name = 'device',
       type = 'table',
-      description = 'Information about the GPU device.',
       table = {
         {
           name = 'id',
           type = 'number',
-          description = 'TODO'
+          description = 'The vendor-unique number for this device.'
         },
         {
           name = 'vendor',
           type = 'number',
-          description = 'TODO'
+          description = 'The identifier of the GPU vendor.'
         },
         {
           name = 'name',
           type = 'string',
-          description = 'TODO'
+          description = 'The name of the GPU.'
         },
         {
           name = 'renderer',
           type = 'string',
-          description = 'TODO'
+          description = 'The renderer in use, currently either "Vulkan" or "WebGPU".'
         },
         {
           name = 'subgroupSize',
           type = 'number',
-          description = 'TODO'
+          description = [[
+            The number of threads that run in a single GPU compute unit.  This is usually 32 or 64,
+            and is sometimes called the "wave" or "warp" size.  This can be used to optimize compute
+            shaders for the current hardware.
+          ]]
         },
         {
           name = 'discrete',
           type = 'boolean',
-          description = 'TODO'
+          description = 'Whether the GPU is a discrete graphics card.'
         }
       }
     }
   },
+  notes = [[
+    The device and vendor ID numbers will usually be PCI IDs, which are standardized numbers
+    consisting of 4 hex digits.  Various online databases and system utilities can be used to look
+    up these numbers.  Here are some example vendor IDs for a few popular GPU manufacturers:
+
+    <table>
+      <thead>
+        <tr>
+          <td>ID</td>
+          <td>Vendor</td>
+        </tr>
+      </thead>
+      <tbody>
+        <tr>
+          <td><code>0x1002</code></td>
+          <td>Advanced Micro Devices Inc.</td>
+        </tr>
+        <tr>
+          <td><code>0x8086</code></td>
+          <td>Intel Corporation</td>
+        </tr>
+        <tr>
+          <td><code>0x10de</code></td>
+          <td>NVIDIA Corporation</td>
+        </tr>
+      </tbody>
+    </table>
+
+    It is not currently possible to get the version of the GPU driver, although this could be added.
+
+    Regarding multiple GPUs: If OpenXR is enabled, the OpenXR runtime has control over which GPU is
+    used, which ensures best compatibility with the VR headset.  Otherwise, the "first" GPU returned
+    by the renderer will be used.  There is currently no other way to pick a GPU to use.
+  ]],
   related = {
     'lovr.graphics.getFeatures',
     'lovr.graphics.getLimits',

+ 2 - 3
api/lovr/graphics/init.lua

@@ -46,9 +46,8 @@ return {
       description = 'TODO'
     },
     {
-      name = 'Miscellaneous',
-      tag = 'graphics-misc',
-      description = 'Hardware info and statistics.'
+      name = 'System Info',
+      tag = 'graphics-misc'
     }
   }
 }

Some files were not shown because too many files changed in this diff