You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: meta/3rd/love2d/library/love/graphics.lua
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -410,11 +410,11 @@ function love.graphics.getMeshCullMode() end
410
410
---love.graphics.getDimensions gets the dimensions of the window in units scaled by the screen's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing to the screen and using the graphics coordinate system (calculating the center of the screen, for example), and getPixelDimensions only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).
411
411
---
412
412
---
413
-
---[Open in Browser](https://love2d.org/wiki/love.graphics.getPixelDimenions)
413
+
---[Open in Browser](https://love2d.org/wiki/love.graphics.getPixelDimensions)
414
414
---
415
415
---@returnnumber pixelwidth # The width of the window in pixels.
416
416
---@returnnumber pixelheight # The height of the window in pixels.
Copy file name to clipboardExpand all lines: meta/3rd/lovr/library/lovr/audio.lua
+42-8Lines changed: 42 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,7 @@ lovr.audio = {}
15
15
---
16
16
---This affects Sources that have the `absorption` effect enabled, causing audio volume to drop off with distance as it is absorbed by the medium it's traveling through (air, water, etc.).
17
17
---
18
-
---The difference between absorption and falloff is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones.
19
-
---
20
-
---This can be used to apply "underwater" effects and stuff.
18
+
---The difference between absorption and the attenuation effect is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones. This can be used to apply "underwater" effects and stuff.
21
19
---
22
20
---
23
21
---### NOTE:
@@ -186,7 +184,7 @@ function lovr.audio.isStarted(type) end
functionlovr.audio.newSource(filename, options) end
192
190
@@ -195,7 +193,7 @@ function lovr.audio.newSource(filename, options) end
195
193
---
196
194
---This affects Sources that have the `absorption` effect enabled, causing audio volume to drop off with distance as it is absorbed by the medium it's traveling through (air, water, etc.).
197
195
---
198
-
---The difference between absorption and falloff is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones.
196
+
---The difference between absorption and the attenuation effect is that absorption is more subtle and is frequency-dependent, so higher-frequency bands can get absorbed more quickly than lower ones.
199
197
---
200
198
---This can be used to apply "underwater" effects and stuff.
201
199
---
@@ -419,6 +417,20 @@ function Source:getDuration(unit) end
419
417
---@returnnumber az # The z component of the axis of rotation.
420
418
functionSource:getOrientation() end
421
419
420
+
---
421
+
---Returns the pitch of the Source.
422
+
---
423
+
---
424
+
---### NOTE:
425
+
---The default pitch is 1.
426
+
---
427
+
---Every doubling/halving of the pitch will raise/lower the pitch by one octave.
428
+
---
429
+
---Changing the pitch also changes the playback speed.
430
+
---
431
+
---@returnnumber pitch # The pitch.
432
+
functionSource:getPitch() end
433
+
422
434
---
423
435
---Returns the position and orientation of the Source.
424
436
---
@@ -485,7 +497,7 @@ function Source:getVolume(units) end
485
497
---
486
498
---See `lovr.audio.getSpatializer` for a table showing the effects supported by each spatializer.
487
499
---
488
-
---Calling this function on a Source that was created with `{ effects = false }` will always return false.
500
+
---Calling this function on a non-spatial Source will always return false.
489
501
---
490
502
---@parameffectlovr.Effect # The effect.
491
503
---@returnboolean enabled # Whether the effect is enabled.
@@ -503,6 +515,14 @@ function Source:isLooping() end
503
515
---@returnboolean playing # Whether the Source is playing.
504
516
functionSource:isPlaying() end
505
517
518
+
---
519
+
---Returns whether the Source was created with the `spatial` flag.
520
+
---
521
+
---Non-spatial sources are routed directly to the speakers and can not use effects.
522
+
---
523
+
---@returnboolean spatial # Whether the source is spatial.
524
+
functionSource:isSpatial() end
525
+
506
526
---
507
527
---Pauses the source.
508
528
---
@@ -573,7 +593,7 @@ function Source:setDirectivity(weight, power) end
573
593
---
574
594
---See `lovr.audio.getSpatializer` for a table showing the effects supported by each spatializer.
575
595
---
576
-
---Calling this function on a Source that was created with `{ effects = false }` will throw an error.
596
+
---Calling this function on a non-spatial Source will throw an error.
577
597
---
578
598
---@parameffectlovr.Effect # The effect.
579
599
---@paramenableboolean # Whether the effect should be enabled.
@@ -598,6 +618,20 @@ function Source:setLooping(loop) end
598
618
---@paramaznumber # The z component of the axis of rotation.
599
619
functionSource:setOrientation(angle, ax, ay, az) end
600
620
621
+
---
622
+
---Sets the pitch of the Source.
623
+
---
624
+
---
625
+
---### NOTE:
626
+
---The default pitch is 1.
627
+
---
628
+
---Every doubling/halving of the pitch will raise/lower the pitch by one octave.
629
+
---
630
+
---Changing the pitch also changes the playback speed.
631
+
---
632
+
---@parampitchnumber # The new pitch.
633
+
functionSource:setPitch(pitch) end
634
+
601
635
---
602
636
---Sets the position and orientation of the Source.
603
637
---
@@ -763,7 +797,7 @@ function Source:tell(unit) end
763
797
---
764
798
---Decreases audio volume with distance (1 / max(distance, 1)).
765
799
---
766
-
---| "falloff"
800
+
---| "attenuation"
767
801
---
768
802
---Causes audio to drop off when the Source is occluded by geometry.
Copy file name to clipboardExpand all lines: meta/3rd/lovr/library/lovr/graphics.lua
+64-12Lines changed: 64 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1477,7 +1477,7 @@ local Pass = {}
1477
1477
---
1478
1478
---Similar to `Pass:copy`, except the source and destination sizes can be different.
1479
1479
---
1480
-
---The pixels from the source texture will be scaled to the destination size.
1480
+
---The pixels from the source texture will be scaled to the destination size. This can only be called on a transfer pass, which can be created with `lovr.graphics.getPass`.
1481
1481
---
1482
1482
---
1483
1483
---### NOTE:
@@ -1546,6 +1546,8 @@ function Pass:circle(transform, style, angle1, angle2, segments) end
1546
1546
---
1547
1547
---Clears a Buffer or Texture.
1548
1548
---
1549
+
---This can only be called on a transfer pass, which can be created with `lovr.graphics.getPass`.
---@paramindex?number # The index of the first item to clear.
@@ -1555,24 +1557,59 @@ function Pass:clear(buffer, index, count) end
1555
1557
---
1556
1558
---Runs a compute shader.
1557
1559
---
1558
-
---Compute shaders are run in 3D grids of workgroups.
1560
+
---Before calling this, a compute shader needs to be active, using `Pass:setShader`.
1559
1561
---
1560
-
---Each local workgroup is itself a 3D grid of invocations, declared using `local_size_x`, `local_size_y`, and `local_size_z` in the shader code.
1562
+
---This can only be called on a Pass with the `compute` type, which can be created using `lovr.graphics.getPass`.
1561
1563
---
1562
1564
---
1563
1565
---### NOTE:
1564
-
---All these 3D grids can get confusing, but the basic idea is to make the local workgroup size a small block of e.g. 8x8 pixels or 4x4x4 voxels, and then dispatch however many global workgroups are needed to cover an image or voxel field.
1566
+
---Usually compute shaders are run many times in parallel: once for each pixel in an image, once per particle, once per object, etc.
1567
+
---
1568
+
---The 3 arguments represent how many times to run, or "dispatch", the compute shader, in up to 3 dimensions.
1569
+
---
1570
+
---Each element of this grid is called a **workgroup**.
1571
+
---
1572
+
---To make things even more complicated, each workgroup itself is made up of a set of "mini GPU threads", which are called **local workgroups**.
1573
+
---
1574
+
---Like workgroups, the local workgroup size can also be 3D.
---All these 3D grids can get confusing, but the basic idea is to make the local workgroup size a small block of e.g. 32 particles or 8x8 pixels or 4x4x4 voxels, and then dispatch however many workgroups are needed to cover a list of particles, image, voxel field, etc.
1581
+
---
1582
+
---The reason to do it this way is that the GPU runs its threads in little fixed-size bundles called subgroups.
1583
+
---
1584
+
---Subgroups are usually 32 or 64 threads (the exact size is given by the `subgroupSize` property of `lovr.graphics.getDevice`) and all run together.
1585
+
---
1586
+
---If the local workgroup size was `1x1x1`, then the GPU would only run 1 thread per subgroup and waste the other 31 or 63.
1565
1587
---
1566
-
---The reason to do it this way is that the GPU runs invocations in bundles called subgroups.
1588
+
---So for the best performance, be sure to set a local workgroup size bigger than 1!
1567
1589
---
1568
-
---Subgroups are usually 32 or 64 invocations (the exact size is given by the `subgroupSize` property of `lovr.graphics.getDevice`).
1590
+
---Inside the compute shader, a few builtin variables can be used to figure out which workgroup is running:
1569
1591
---
1570
-
---If the local workgroup size was `1x1x1`, then the GPU would only run 1 invocation per subgroup and waste the other 31 or 63.
1592
+
---- `uvec3 WorkgroupCount` is the workgroup count per axis (the `Pass:compute` arguments).
1593
+
---- `uvec3 WorkgroupSize` is the local workgroup size (declared in the shader).
1594
+
---- `uvec3 WorkgroupID` is the index of the current (global) workgroup.
1595
+
---- `uvec3 LocalThreadID` is the index of the local workgroup inside its workgroup.
1596
+
---- `uint LocalThreadIndex` is a 1D version of `LocalThreadID`.
1597
+
---- `uvec3 GlobalThreadID` is the unique identifier for a thread within all workgroups in a
1598
+
--- dispatch. It's equivalent to `WorkgroupID * WorkgroupSize + LocalThreadID` (usually what you
1599
+
--- want!)
1600
+
---
1601
+
---Indirect compute dispatches are useful to "chain" compute shaders together, while keeping all of the data on the GPU.
1602
+
---
1603
+
---The first dispatch can do some computation and write some results to buffers, then the second indirect dispatch can use the data in those buffers to know how many times it should run.
1604
+
---
1605
+
---An example would be a compute shader that does some sort of object culling, writing the number of visible objects to a buffer along with the IDs of each one. Subsequent compute shaders can be indirectly dispatched to perform extra processing on the visible objects.
1606
+
---
1607
+
---Finally, an indirect draw can be used to render them.
@@ -1714,6 +1751,7 @@ function Pass:getTarget() end
1714
1751
---
1715
1752
---The type restricts what kinds of functions can be called on the pass.
1716
1753
---
1754
+
---@returnlovr.PassType type # The type of the Pass.
1717
1755
functionPass:getType() end
1718
1756
1719
1757
---
@@ -1802,6 +1840,10 @@ function Pass:mesh(vertices, transform, start, count, instances, base) end
1802
1840
---
1803
1841
---Generates mipmaps for a texture.
1804
1842
---
1843
+
---This can only be called on a transfer pass, which can be created with `lovr.graphics.getPass`.
1844
+
---
1845
+
---When rendering to textures with a render pass, it's also possible to automatically regenerate mipmaps after rendering by adding the `mipmaps` flag when creating the pass.
1846
+
---
1805
1847
---@paramtexturelovr.Texture # The texture to mipmap.
1806
1848
---@parambase?number # The index of the mipmap used to generate the remaining mipmaps.
1807
1849
---@paramcount?number # The number of mipmaps to generate. If nil, generates the remaining mipmaps.
@@ -1871,7 +1913,9 @@ function Pass:push(stack) end
1871
1913
---
1872
1914
---Creates a `Readback` object which asynchronously downloads data from a `Buffer`, `Texture`, or `Tally`.
1873
1915
---
1874
-
---The readback can be polled for completion, or, after this transfer pass is completed, `Readback:wait` can be used to block until the download is complete.
1916
+
---The readback can be polled for completion, or, after this transfer pass is submitted, `Readback:wait` can be used to block until the download is complete.
1917
+
---
1918
+
---This can only be called on a transfer pass, which can be created with `lovr.graphics.getPass`.
0 commit comments