Commit Graph

62 Commits

Author SHA1 Message Date
John Doe fc5eeb11a3 Fix copyright notice date 2026-01-21 18:49:11 +00:00
John Doe 6f08eb94c6 Update copyright notice with correct year 2025-07-12 23:19:22 +01:00
Sasha Szpakowski fe23e1920b Fix some compile warnings 2024-12-29 14:09:13 -04:00
Sasha Szpakowski ec9fb6eb28 Improve Windows vulkan draw performance by reducing the size of a struct. 2024-03-10 14:33:29 -03:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski 94d5864144 update year for copyright notice 2024-02-10 12:13:22 -04:00
Sasha Szpakowski 910533edda Initial code for sending flat-array matrices to storage buffers (untested). 2023-11-24 14:12:47 -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 f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
Sasha Szpakowski c823dbca96 Update copyright year for 2023 2022-12-31 22:25:49 -04:00
Alex Szpakowski a533982cb4 Replace internal 'staging' buffer data type with new 'readback' type. 2022-05-30 21:43:25 -03:00
Alex Szpakowski d51e012812 Merge branch '12.0-development' into metal 2022-01-05 21:12:22 -04:00
Alex Szpakowski 7f3538d2ba Merge branch 'main' into 12.0-development 2022-01-05 21:10:27 -04:00
Alex Szpakowski 40aa50662a Merge branch '12.0-development' into metal 2022-01-01 15:36:57 -04:00
Alex Szpakowski 8e7fd10b6f Update copyright year for 2022 2021-12-31 18:33:40 -04:00
Alex Szpakowski bfcf025ef7 Add 'staging' buffer data usage enum. 2021-12-28 12:49:33 -04:00
Alex Szpakowski 5b3a5e7721 Remove the need for copysource and copydest buffer usage flags. 2021-12-27 21:17:04 -04:00
Alex Szpakowski e63025b74f Merge branch '12.0-development' into metal 2021-12-24 15:34:05 -04:00
Alex Szpakowski 21f5ba86d3 Merge branch 'master' into 12.0-development 2021-04-07 20:33:44 -03:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Alex Szpakowski aad0810e11 metal: initial (bad/slow) setShader tracking 2021-03-29 18:28:06 -03:00
Alex Szpakowski deff795908 Rename some internal buffer enums to better match what they do 2021-01-17 20:59:16 -04:00
Alex Szpakowski e2838131f2 Add love.graphics.copyBuffer. 2021-01-17 14:02:00 -04:00
Alex Szpakowski 50ff86bd92 Graphics Buffers can be used as Shader Storage Buffers. 2021-01-10 17:53:12 -04:00
Alex Szpakowski b011487a3e Add new texel buffer type.
GLSL 3+ shaders can read from texel buffers by declaring a uniform samplerBuffer variable and calling texelFetch with a 0-based index, in the shader code. All attributes in a texel buffer's format array must have the same data format (e.g. all 'floatvec4' formats).

Shader:send accepts a texel Buffer for samplerBuffer uniforms.

Added 'texelbuffer' to love.graphics.getSupported (requires GLSL 3+ and desktop OpenGL).
Added 'texelbuffersize' to love.graphics.getSystemLimits. Returns the max number of values in a texel buffer (array length multiplied by the number of attributes declared in the buffer's format array).
2020-07-28 20:44:36 -03:00
Alex Szpakowski 2d7267a428 Add Buffer:isBufferType and Buffer:isCPUReadable. 2020-07-26 16:43:40 -03:00
Alex Szpakowski e60736f5a6 Add Mesh:set/getIndexBuffer. 2020-07-20 22:10:08 -03:00
Alex Szpakowski 4197a364fd Internal restructuring of some Mesh code 2020-02-23 22:39:18 -04:00
Alex Szpakowski 2c90ccabb3 Avoid some hardcoded strings 2020-02-23 16:49:38 -04:00
Alex Szpakowski 2828761060 Move some code from Mesh wrapper to Buffer wrapper 2020-02-22 18:58:41 -04:00
Alex Szpakowski 2572f0c7a1 Meshes expose GraphicsBuffers, part 2 2020-02-01 15:39:59 -04:00
Alex Szpakowski 25d9ae2ba0 Meshes expose vertex buffers, part 1
(compiles, but is currently half-implemented and broken)
2020-01-19 15:03:19 -04:00
Alex Szpakowski d597275207 Add StringMap for DataFormat 2020-01-15 23:26:24 -04:00
Alex Szpakowski d5d50d2e0d Move DataFormat enum to vertex.h 2020-01-13 23:20:49 -04:00
Alex Szpakowski 1bc2b947fc Rename Attributes struct to VertexAttributes 2020-01-13 20:44:39 -04:00
Alex Szpakowski ee5304ba53 Remove vertex namespace 2020-01-13 20:41:05 -04:00
Alex Szpakowski 23bc1a7aae Add new mesh data formats: int32, uint32, [u]int8, [u]int16, snorm8, and snorm16.
Integer formats for vertex attributes are only supported in glsl3 shaders. They use ivec/uvec types in glsl.

--HG--
branch : minor
2020-01-11 22:24:38 -04:00
Alex Szpakowski 5f9b5a21d0 Merge default into minor
--HG--
branch : minor
2020-01-03 22:45:36 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski 3435a6bcbf Change the internal constant color from a (per-draw) vertex attribute to a uniform. Pack most built-in uniforms into a single vec4 array and update them all with a single glUniform call.
--HG--
branch : minor
2019-11-18 21:13:54 -04:00
Alex Szpakowski 9ab2a94037 Rename internal C++ Color struct to Color32 to help differentiate it from Colorf. 2019-09-14 23:13:40 -03:00
Alex Szpakowski 55d4dc0f9e Restructure some internal vertex buffer binding code to be closer to how graphics APIs actually behave. 2019-08-25 16:50:15 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Michael Vetter a1d6da4624 Silence compiler warning
Silence compiler warnings about methods with return value and potentially not returning anything.
This happens with gcc8 and the `-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -std=c++11` flags passed to it by default on openSUSE.
2018-11-29 17:07:20 +01:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski 7354de2059 Add (low level) functionality to allow rendering 3D Meshes.
- Add love.graphics.setDepthMode(testcomparison, enablewrites).
- Add love.graphics.setMeshCullMode.
- Add love.graphics.setFrontFaceWinding.

Depth testing and depth writes require a depth buffer to work. The mesh cull mode controls whether front/back faces of a mesh are culled. The front face winding determines whether a clockwise or counterclockwise-oriented face in a mesh is considered front facing.

--HG--
branch : minor
2017-12-09 23:34:08 -04:00
Alex Szpakowski 7ffb04f019 Fix windows build
--HG--
branch : minor
2017-10-25 23:23:41 -03:00
Alex Szpakowski 15cc540e4c Make internal vertex attribute code less OpenGL-specific.
--HG--
branch : minor
2017-10-25 23:12:39 -03:00
Alex Szpakowski b0c5bf2156 Fix build?
--HG--
branch : minor
2017-10-22 12:37:30 -03:00
Alex Szpakowski 7a2e52b12d Cleaned up some vertex data-related code.
--HG--
branch : minor
2017-10-22 12:33:47 -03:00