Commit Graph

4777 Commits

Author SHA1 Message Date
Sasha Szpakowski 1909e80409 Add ByteData:setString. 2023-02-19 20:26:35 -04:00
Sasha Szpakowski 78de7bdf3c Move ByteData float/int getter methods to Data. 2023-02-19 19:52:07 -04:00
Sasha Szpakowski 416abdbc59 love.graphics.copyBuffer: slightly more robust error handling. 2023-02-19 19:36:32 -04:00
Sasha Szpakowski c70b0a0b03 Add Buffer:clear, to reset all or part of a Buffer's contents to 0. 2023-02-19 19:36:03 -04:00
Sasha Szpakowski 11c92ece33 Merge pull request #1902 from nikeinikei/12.0-development
Improve vk render passes
2023-02-14 21:23:45 -04:00
niki 5eae82ab33 vulkan: fix gammacorrect in Graphics::clear 2023-02-15 01:22:38 +01:00
Sasha Szpakowski 70a18e115f vulkan: don't set CREATE_DEDICATED_MEMORY flag for buffer memory.
It was being set all the time because of a code bug, but also documentation recommends using it very sparingly - partly because systems have a hard limit on the number of individual allocations (and they can also be a lot slower).

We might want to revisit more selective use of the flag in the future.
2023-02-14 20:18:26 -04:00
Sasha Szpakowski 139c68d197 better error checking for Data:getString's size parameter. 2023-02-13 19:41:25 -04:00
Sasha Szpakowski f6416dd584 Add optional byte offset and size parameters to Data:getString. 2023-02-13 19:39:31 -04:00
Sasha Szpakowski 02e8acc0d2 Add ByteData methods for getting/setting number values.
See #1594
2023-02-13 19:37:59 -04:00
niki 4f321d69e7 vulkan: cache depthStencilFormat 2023-02-12 14:52:30 +01:00
niki dc6e080d18 vulkan: code styling 2023-02-12 14:18:26 +01:00
niki 6183f67598 vulkan: fix wrong attachment load op 2023-02-12 00:54:03 +01:00
niki 2fc5a8afe0 vulkan: removed unused optional extension 2023-02-12 00:22:51 +01:00
niki 14e08a2b03 vulkan: remove default renderpasses & framebuffers
There is little to no performance gain, with a lot of burden
to maintenance of the extra path. It's better to unify the code
with the other render pass logic.
2023-02-11 22:36:39 +01:00
niki b698c0f11a vulkan: rename to OptionalDeviceExtensions
The previous name was misleading.
2023-02-11 22:21:07 +01:00
Sasha Szpakowski 3fb5ddadcb compile error fixes for linux/iOS 2023-02-11 16:39:38 -04:00
Sasha Szpakowski 95d44c2c2d very minor compile speed improvements 2023-02-11 16:29:24 -04:00
Sasha Szpakowski ee96b6fa68 Fix a crash when printing an empty string. 2023-02-11 15:55:49 -04:00
nikeinikei 2adc0070e4 Merge branch 'love2d:12.0-development' into 12.0-development 2023-02-11 20:28:28 +01:00
niki 7415cb2d02 vulkan: fix incorrect render pass hashing 2023-02-11 20:25:54 +01:00
niki b04ba7ecb4 vulkan: fix incorrect loadOp 2023-02-11 20:20:49 +01:00
niki d06926eae9 Merge branch '12.0-development' of https://github.com/nikeinikei/love into 12.0-development 2023-02-11 20:06:22 +01:00
niki 094d6e39d1 vulkan: improve render pass performance
Before this patch some common patterns would lead to very suboptimal
render passes.
Consider the following code:
```lua
local canvas = love.graphics.newCanvas(...)

function love.draw()
    love.graphics.setCanvas(canvas)
    love.graphics.clear(...)
    love.graphics.draw(...)
    love.graphics.setCanvas()

    love.graphics.draw(canvas)
end
```
This would lead to the following rendering:
1) render pass on main window with loadOp=load, followed by an immediate
    call to vkCmdClearAttachments
2) render pass on canvas with loadOp=load, followed by an immediate call
    to vkCmdClearAttachments
3) render pass on main window with loadOp=load

This patch changes the behaviour to the more performant
(and equivalent) version:
1) render pass on canvas with loadOp=clear
2) render pass on main window with loadOp=clear

This is especially helpful on mobile devices, where creating render
passes is an expensive operation.
2023-02-11 20:06:19 +01:00
Sasha Szpakowski c24f95d72e Merge pull request #1901 from Er2ch/harfbuzz
Fix Harfbuzz wasn't properly found on some systems
2023-02-11 13:25:25 -04:00
Er2 94daeea31e Add FindHarfbuzz.cmake 2023-02-11 16:56:58 +00:00
Sasha Szpakowski 594c251f4b update changelog with removals of functions deprecated in love 11. 2023-02-11 11:49:49 -04:00
Sasha Szpakowski 60a8fca45c The old love.graphics stencil APIs are deprecated, not removed. 2023-02-11 11:35:04 -04:00
Sasha Szpakowski 1a586f8156 small changelog fix 2023-02-06 20:48:43 -04:00
Sasha Szpakowski 47e51af487 Add Joystick:getJoystickType. 2023-02-06 18:16:19 -04:00
Sasha Szpakowski 46d98e4b77 update changelog 2023-02-06 17:57:20 -04:00
nikeinikei edeab5e4e8 Merge branch 'love2d:12.0-development' into 12.0-development 2023-02-06 12:19:19 +01:00
Sasha Szpakowski 6ac7c09d90 shaders: default to std430 layout for storage buffers. 2023-02-05 22:16:28 -04:00
Sasha Szpakowski 2178b634c8 Add functions for indirect draws and compute dispatches.
Resolves #1879.

- Add an 'indirectdraw' boolean field to the graphics feature support table returned by love.graphics.getSupported. This is almost always supported when compute shaders are supported, except on a few older phones.

- Add an 'indirectarguments' boolean field to the settings table in love.graphics.newBuffer.

- Add love.graphics.dispatchIndirect(shader, argumentsbuffer [, argumentsindex = 1]).
    The compute dispatch's threadgroup width, height, and depth values are fetched from the buffer (as 3 uints) instead of coming from function parameters.

- Add love.graphics.drawIndirect(mesh, argumentsbuffer, argumentsindex, x, y, ....).
    Vertex or index count, instance count, and other related parameters for drawing the mesh are fetched from the buffer (as 4 or 5 uints depending on whether the mesh has an index buffer) instead of coming from function parameters. It's usually a good idea to keep parameters other than the instance count in sync with what the mesh should be using.

- Add love.graphics.drawFromShaderIndirect(drawmode, argumentsbuffer [, argumentsindex = 1] [, maintexture = nil]) and drawFromShaderIndirect(indexbuffer, argumentsbuffer [, argumentsindex] [, maintexture = nil]).
    Vertex or index count, instance count, and other related parameters are fetched from the buffer as 4 or 5 uints, as above.

For the dispatch indirect arguments buffer, it has to have 3 uint32 elements: { uint threadgroupsX, uint threadgroupsY, uint threadgroupsZ }.

For non-indexed draws, the arguments buffer has to have 4 uint32 elements: { uint vertexCount, uint instanceCount, uint baseVertex, uint baseInstance }. Note that baseInstance should always be set to 0 as many drivers don't support non-zero values.

For draws which use an index buffer, the arguments buffer has to have 5 uint32 elements: { uint indexCount, uint instanceCount, uint firstIndex, uint baseVertex, uint baseInstance }. As above, the baseInstance value should always be 0.

A buffer can be created to have an array of those structures, which can be used with the argumentsindex parameter of the Indirect dispatch/draw functions.
2023-02-05 15:55:19 -04:00
Sasha Szpakowski d3747cebb1 Rename love.graphics.drawShaderVertices to drawFromShader. 2023-02-05 15:16:10 -04:00
Sasha Szpakowski e13b0078a2 shaders: ignore code in comments when parsing entry point functions.
Fixes #1581.
2023-02-04 10:25:13 -04:00
niki 9f452474c7 vulkan: remove unnecessary getDevice() calls 2023-01-31 01:07:02 +01:00
Sasha Szpakowski defe811f62 Allow creating a mipmapped texture with less than the full mip range.
When creating a texture with user-specified mipmaps, it no longer errors if all mipmaps down to 1x1 aren't present.

Added a 'mipmapcount' field to the settings table in newImage and friends (only used when mipmaps are enabled for the texture.) If it's set, only mipmap levels up to the specified count will be created instead of always creating the full range.

Old OpenGL ES 2 devices don't support loading a mipmapped texture without the full mipmap range, so there's a new 'mipmaprange' boolean field in the table returned by love.graphics.getSupported.
2023-01-29 16:02:39 -04:00
Sasha Szpakowski 8706f0ef6a Rename Texture:isRenderTarget to Texture:isCanvas. 2023-01-29 15:58:31 -04:00
niki 0e1f645538 vulkan: clean up glslang objects properly
By using smart pointers we don't want to worry about
explicitely deleting.
2023-01-29 01:14:06 +01:00
niki f01457a610 vulkan: remove internal Shader::attach call
Shader::attach() should not be called internally
by a graphics backend.
2023-01-27 14:10:19 +01:00
nikeinikei fdc860e6b6 Merge branch 'love2d:12.0-development' into 12.0-development 2023-01-27 13:53:32 +01:00
niki 377d269f4a vulkan: remap bindings to prevent clash
Vulkan does not differentiate between between bindings for textures
and buffers, as opposed to opengl. This can lead to situations, where
different uniforms get assigned the same binding leading to a crash,
when trying to update a descriptor set with the wrong type.
This patch solves this problem, by remapping the bindings when needed.
2023-01-27 02:36:10 +01:00
Miku AuahDark 61352b90a5 Update dr_mp3 to 0.6.34.
Closes #1898
2023-01-24 20:42:21 +08:00
niki a2466a4a1b vulkan: use temporary pipeline cache 2023-01-22 00:17:42 +01:00
Sasha Szpakowski 7e661d2fb1 Merge pull request #1892 from MikuAuahDark/srcindex
Provide PDB with Source Indexing as Artifacts
2023-01-15 15:51:09 -04:00
Miku AuahDark c46423198e Reduce the compiled binary size. 2023-01-15 11:48:04 +08:00
Sasha Szpakowski 9edae19d74 Merge branch 'main' into 12.0-development 2023-01-14 22:40:13 -04:00
Sasha Szpakowski 592c306276 Fix images with mipmaps when ANGLE is used with an AMD gpu. 2023-01-14 22:35:00 -04:00
Sasha Szpakowski 8cac37b811 Fix typo 2023-01-14 12:17:57 -04:00