This allows a Mesh to be created that doesn't have its own internal vertex buffer and purely references other vertex buffers instead.
The prototype looks like this:
mesh = love.graphics.newMesh(attributelist, drawmode)
where attributelist is an array of tables each with the following fields, similar to Mesh:attachAttribute:
{
buffer = vertexbuffer,
name = "VertexPosition", -- the name this vertex attribute will use in a shader
nameinbuffer = nil, -- the name of the attribute in the vertex buffer. Defaults to the name field.
step = nil, -- vertex attribute step ("pervertex" or "perinstance"), defaults to "pervertex".
startindex = nil, -- 1-based array index within the given vertex buffer where the attribute data will start being pulled from during rendering. Defaults to 1.
}
love.graphics.newVertexBuffer and newIndexBuffer don't do enough to justify their existence since love.graphics.newBuffer already covers all buffer creation functionality.
1-based indices in newIndexBuffer versus 0-based indices in newBuffer(..., {index=true}) was also confusing.
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.
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.
This a significant refactor / rewrite of much of the love.graphics Font code.
Text positioning is now split into TextShaper classes in the love.font module. This isn't exposed to users yet.
BMFonts and ImageFonts use the same text shaping as before (in the new TextShaper API). Fonts loaded via FreeType now use Harfbuzz for text shaping.
The new code isn't at feature-parity with the old code yet. Harfbuzz-based text shaping enables kerning support in more fonts, character combining into ligature glyphs, and directions other than left-to-right (this isn't supported in love yet).
The only field currently read from the table is 'defines', which can contain either an array of define names, or name-value pairs.
For example: newShader(file, {defines={"MYFEATURE_ENABLED", MYSETTING=1}})
Fixes#1577
- Add setStencilMode(drawaction, comparemode, value = 0, readmask = 0xFF, writemask = 0xFF).
- Add getStencilMode.
- Remove love.graphics.stencil.
- Remove love.graphics.set/getStencilTest.
Note that the new setStencilMode API does not clear the stencil buffer, and does not turn off color writes (it can still be done manually), unlike love.graphics.stencil.
Fixes#1161.
Fixes#1251.
Remove the variant which accepted no args - it would be too confusing because setColorMask(false) does the opposite of what setColorMask(nil) used to do.
- Added love.graphics.setOrthoProjection.
- Added love.graphics.setPerspectiveProjection.
- Added love.graphics.resetProjection.
Note that the projection is reset whenever the canvas changes.
- Add t.renderers and t.excluderenderers love.conf fields. They can be an array of renderer names.
- Add --renderers a,list,of,renderernames and --excluderenderers more,renderers argument options.
love's pre-generated quad index buffer is useful when combined with drawShaderVertices. Note that it uses 16 bit indices so it can only draw up to 16k quads in a single call.
It draws a number of vertices, or a number of indices from an index buffer, without using any vertex data from a vertex buffer. A custom shader is required while using it.
It is useful when a custom GLSL3 vertex shader which uses love_VertexID is used to pull or compute per-vertex information from other sources.
If a shader uses gl_PointSize then it can only be used when drawing points. If a shader doesn't use gl_PointSize then it can't be used when drawing points.
Added 'ConstantPointSize' and 'CurrentDPIScale' built-in shader uniforms.
ConstantPointSize is in DPI-scaled points, whereas gl_PointSize is in pixels, so to get the correct default behaviour a shader needs to do gl_PointSize = ConstantPointSize * CurrentDPIScale
Allows buffers created with love.graphics.newBuffer to only allocate VRAM data. Previously they had a copy of their contents in RAM.
Also makes it easier to implement Buffers in other graphics APIs and to implement more types of Buffers in the future.