Merge branch '12.0-development' into metal

This commit is contained in:
Alex Szpakowski
2022-01-05 21:12:22 -04:00
506 changed files with 706 additions and 539 deletions
+5 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -36,6 +36,7 @@ Buffer::Buffer(Graphics *gfx, const Settings &settings, const std::vector<DataDe
, usageFlags(settings.usageFlags)
, dataUsage(settings.dataUsage)
, mapped(false)
, immutable(false)
{
if (size == 0 && arraylength == 0)
throw love::Exception("Size or array length must be specified.");
@@ -76,6 +77,9 @@ Buffer::Buffer(Graphics *gfx, const Settings &settings, const std::vector<DataDe
if (indexbuffer)
{
if (!caps.features[Graphics::FEATURE_INDEX_BUFFER_32BIT] && format == DATAFORMAT_UINT32)
throw love::Exception("32 bit index buffer formats are not supported on this system.");
if (format != DATAFORMAT_UINT16 && format != DATAFORMAT_UINT32)
throw love::Exception("Index buffers only support uint16 and uint32 data types.");
+6 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -111,6 +111,9 @@ public:
size_t getMemberOffset(int index) const { return dataMembers[index].offset; }
int getDataMemberIndex(const std::string &name) const;
void setImmutable(bool immutable) { this->immutable = immutable; };
bool isImmutable() const { return immutable; }
/**
* Map a portion of the Buffer to client memory.
*/
@@ -176,6 +179,8 @@ protected:
BufferDataUsage dataUsage;
bool mapped;
bool immutable;
}; // Buffer
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+84 -7
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -246,6 +246,8 @@ void Graphics::createQuadIndexBuffer()
Buffer::Mapper map(*quadIndexBuffer);
fillIndices(TRIANGLEINDEX_QUADS, 0, LOVE_UINT16_MAX, (uint16 *) map.data);
quadIndexBuffer->setImmutable(true);
}
Quad *Graphics::newQuad(Quad::Viewport v, double sw, double sh)
@@ -1150,6 +1152,9 @@ void Graphics::copyBuffer(Buffer *source, Buffer *dest, size_t sourceoffset, siz
if (source == dest && sourcerange.intersects(destrange))
throw love::Exception("Copying a portion of a buffer to the same buffer requires non-overlapping source and destination offsets.");
if (dest->isImmutable())
throw love::Exception("Cannot copy to an immutable buffer.");
source->copyTo(dest, sourceoffset, destoffset, size);
}
@@ -1175,6 +1180,9 @@ void Graphics::copyTextureToBuffer(Texture *source, Buffer *dest, int slice, int
if (dest->getDataUsage() == BUFFERDATAUSAGE_STREAM)
throw love::Exception("Buffers created with 'stream' data usage cannot be used as a copy destination.");
if (dest->isImmutable())
throw love::Exception("Cannot copy to an immutable buffer.");
if (isRenderTargetActive(source))
throw love::Exception("copyTextureToBuffer cannot be called while the Texture is an active render target.");
@@ -1593,6 +1601,75 @@ void Graphics::drawInstanced(Mesh *mesh, const Matrix4 &m, int instancecount)
mesh->drawInstanced(this, m, instancecount);
}
void Graphics::drawShaderVertices(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture)
{
flushBatchedDraws();
if (!capabilities.features[FEATURE_GLSL3])
throw love::Exception("drawShaderVertices is not supported on this system (GLSL3 support is required.)");
if (Shader::isDefaultActive() || !Shader::current)
throw love::Exception("drawShaderVertices can only be used with a custom shader.");
if (vertexcount < 0 || instancecount < 0)
throw love::Exception("drawShaderVertices vertex and instance count parameters must not be negative.");
Shader::current->validateDrawState(primtype, maintexture);
VertexAttributes attributes;
BufferBindings buffers;
DrawCommand cmd(&attributes, &buffers);
cmd.primitiveType = primtype;
cmd.vertexCount = vertexcount;
cmd.instanceCount = std::max(1, instancecount);
cmd.texture = maintexture;
draw(cmd);
}
void Graphics::drawShaderVertices(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture)
{
flushBatchedDraws();
if (!capabilities.features[FEATURE_GLSL3])
throw love::Exception("drawShaderVertices is not supported on this system (GLSL3 support is required.)");
if (!(indexbuffer->getUsageFlags() & BUFFERUSAGEFLAG_INDEX))
throw love::Exception("The buffer passed to drawShaderVertices must be an index buffer.");
if (startindex < 0)
throw love::Exception("drawShaderVertices startindex parameter must not be negative.");
if (indexcount < 0 || instancecount < 0)
throw love::Exception("drawShaderVertices index and instance count parameters must not be negative.");
if ((size_t)(startindex + indexcount) > indexbuffer->getArrayLength() * indexbuffer->getDataMembers().size())
throw love::Exception("drawShaderVertices startindex and index count parameters do not fit in the given index buffer.");
if (Shader::isDefaultActive() || !Shader::current)
throw love::Exception("drawShaderVertices can only be used with a custom shader.");
Shader::current->validateDrawState(PRIMITIVE_TRIANGLES, maintexture);
VertexAttributes attributes;
BufferBindings buffers;
DrawIndexedCommand cmd(&attributes, &buffers, indexbuffer);
cmd.primitiveType = PRIMITIVE_TRIANGLES;
cmd.indexCount = indexcount;
cmd.instanceCount = std::max(1, instancecount);
cmd.indexType = getIndexDataType(indexbuffer->getDataMember(0).decl.format);
cmd.indexBufferOffset = startindex * getIndexDataSize(cmd.indexType);
cmd.texture = maintexture;
draw(cmd);
}
void Graphics::print(const std::vector<Font::ColoredString> &str, const Matrix4 &m)
{
checkSetDefaultFont();
@@ -2067,19 +2144,18 @@ void Graphics::origin()
pixelScaleStack.back() = 1;
}
void Graphics::applyTransform(love::math::Transform *transform)
void Graphics::applyTransform(const Matrix4 &m)
{
Matrix4 &m = transformStack.back();
m *= transform->getMatrix();
Matrix4 &current = transformStack.back();
current *= m;
float sx, sy;
m.getApproximateScale(sx, sy);
current.getApproximateScale(sx, sy);
pixelScaleStack.back() = (sx + sy) / 2.0;
}
void Graphics::replaceTransform(love::math::Transform *transform)
void Graphics::replaceTransform(const Matrix4 &m)
{
const Matrix4 &m = transform->getMatrix();
transformStack.back() = m;
float sx, sy;
@@ -2146,6 +2222,7 @@ STRINGMAP_CLASS_BEGIN(Graphics, Graphics::Feature, Graphics::FEATURE_MAX_ENUM, f
{ "glsl4", Graphics::FEATURE_GLSL4 },
{ "instancing", Graphics::FEATURE_INSTANCING },
{ "texelbuffer", Graphics::FEATURE_TEXEL_BUFFER },
{ "indexbuffer32bit", Graphics::FEATURE_INDEX_BUFFER_32BIT },
{ "copybuffer", Graphics::FEATURE_COPY_BUFFER },
{ "copybuffertotexture", Graphics::FEATURE_COPY_BUFFER_TO_TEXTURE },
{ "copytexturetobuffer", Graphics::FEATURE_COPY_TEXTURE_TO_BUFFER },
+9 -3
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -156,6 +156,7 @@ public:
FEATURE_GLSL4,
FEATURE_INSTANCING,
FEATURE_TEXEL_BUFFER,
FEATURE_INDEX_BUFFER_32BIT,
FEATURE_COPY_BUFFER,
FEATURE_COPY_BUFFER_TO_TEXTURE,
FEATURE_COPY_TEXTURE_TO_BUFFER,
@@ -523,6 +524,8 @@ public:
virtual int getRequestedBackbufferMSAA() const = 0;
virtual int getBackbufferMSAA() const = 0;
Buffer *getQuadIndexBuffer() const { return quadIndexBuffer; }
/**
* Sets the current constant color.
**/
@@ -693,6 +696,9 @@ public:
void drawLayer(Texture *texture, int layer, Quad *quad, const Matrix4 &m);
void drawInstanced(Mesh *mesh, const Matrix4 &m, int instancecount);
void drawShaderVertices(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture);
void drawShaderVertices(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture);
/**
* Draws text at the specified coordinates
**/
@@ -836,8 +842,8 @@ public:
void shear(float kx, float ky);
void origin();
void applyTransform(love::math::Transform *transform);
void replaceTransform(love::math::Transform *transform);
void applyTransform(const Matrix4 &m);
void replaceTransform(const Matrix4 &m);
Vector2 transformPoint(Vector2 point);
Vector2 inverseTransformPoint(Vector2 point);
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -449,7 +449,7 @@ static const Version versions[] =
{
{ "#version 120", "#version 100" },
{ "#version 330 core", "#version 300 es" },
{ "#version 430 core", "#version 310 es" },
{ "#version 430 core", "#version 320 es" },
};
static Shader::Language getTargetLanguage(const std::string &src)
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+6 -4
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -151,7 +151,9 @@ bool Buffer::load(const void *initialdata)
glGenTextures(1, &texture);
gl.bindBufferTextureToUnit(texture, 0, false, true);
glTexBuffer(target, getGLFormat(getDataMember(0).decl.format), buffer);
GLenum glformat = getGLFormat(getDataMember(0).decl.format);
glTexBuffer(target, glformat, buffer);
}
return (glGetError() == GL_NO_ERROR);
@@ -164,7 +166,7 @@ bool Buffer::supportsOrphan() const
void *Buffer::map(MapType /*map*/, size_t offset, size_t size)
{
if (size == 0)
if (size == 0 || isImmutable())
return nullptr;
Range r(offset, size);
@@ -227,7 +229,7 @@ void Buffer::unmap(size_t usedoffset, size_t usedsize)
void Buffer::fill(size_t offset, size_t size, const void *data)
{
if (size == 0)
if (size == 0 || isImmutable())
return;
size_t buffersize = getSize();
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+3 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1657,11 +1657,12 @@ void Graphics::initCapabilities()
capabilities.features[FEATURE_GLSL4] = GLAD_ES_VERSION_3_1 || (gl.isCoreProfile() && GLAD_VERSION_4_3);
capabilities.features[FEATURE_INSTANCING] = gl.isInstancingSupported();
capabilities.features[FEATURE_TEXEL_BUFFER] = gl.isBufferUsageSupported(BUFFERUSAGE_TEXEL);
capabilities.features[FEATURE_INDEX_BUFFER_32BIT] = GLAD_VERSION_1_1 || GLAD_ES_VERSION_3_0 || GLAD_OES_element_index_uint;
capabilities.features[FEATURE_COPY_BUFFER] = gl.isCopyBufferSupported();
capabilities.features[FEATURE_COPY_BUFFER_TO_TEXTURE] = gl.isCopyBufferToTextureSupported();
capabilities.features[FEATURE_COPY_TEXTURE_TO_BUFFER] = gl.isCopyTextureToBufferSupported();
capabilities.features[FEATURE_COPY_RENDER_TARGET_TO_BUFFER] = gl.isCopyRenderTargetToBufferSupported();
static_assert(FEATURE_MAX_ENUM == 15, "Graphics::initCapabilities must be updated when adding a new graphics feature!");
static_assert(FEATURE_MAX_ENUM == 16, "Graphics::initCapabilities must be updated when adding a new graphics feature!");
capabilities.limits[LIMIT_POINT_SIZE] = gl.getMaxPointSize();
capabilities.limits[LIMIT_TEXTURE_SIZE] = gl.getMax2DTextureSize();
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -3
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1479,8 +1479,7 @@ bool OpenGL::isBufferUsageSupported(BufferUsage usage) const
case BUFFERUSAGE_INDEX:
return true;
case BUFFERUSAGE_TEXEL:
// Not supported in ES until 3.2, which we don't support shaders for...
return GLAD_VERSION_3_1;
return GLAD_VERSION_3_1 || GLAD_ES_VERSION_3_2;
case BUFFERUSAGE_SHADER_STORAGE:
return (GLAD_VERSION_4_3 && isCoreProfile()) || GLAD_ES_VERSION_3_1;
case BUFFERUSAGE_MAX_ENUM:
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+54 -6
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -242,6 +242,12 @@ int w_getDPIScale(lua_State *L)
return 1;
}
int w_getQuadIndexBuffer(lua_State *L)
{
luax_pushtype(L, instance()->getQuadIndexBuffer());
return 1;
}
static Graphics::RenderTarget checkRenderTarget(lua_State *L, int idx)
{
lua_rawgeti(L, idx, 1);
@@ -2938,6 +2944,42 @@ int w_drawInstanced(lua_State *L)
return 0;
}
int w_drawShaderVertices(lua_State *L)
{
if (luax_istype(L, 1, Buffer::type))
{
// Indexed drawing.
Buffer *t = luax_checkbuffer(L, 1);
int indexcount = (int) luaL_checkinteger(L, 2);
int instancecount = (int) luaL_optinteger(L, 3, 1);
int indexstart = (int) luaL_optinteger(L, 4, 1) - 1;
Texture *tex = nullptr;
if (!lua_isnoneornil(L, 5))
tex = luax_checktexture(L, 5);
luax_catchexcept(L, [&]() { instance()->drawShaderVertices(t, indexcount, instancecount, indexstart, tex); });
}
else
{
const char *primstr = luaL_checkstring(L, 1);
PrimitiveType primtype = PRIMITIVE_TRIANGLES;
if (!getConstant(primstr, primtype))
return luax_enumerror(L, "primitive type", getConstants(primtype), primstr);
int vertexcount = (int) luaL_checkinteger(L, 2);
int instancecount = (int) luaL_optinteger(L, 3, 1);
Texture *tex = nullptr;
if (!lua_isnoneornil(L, 4))
tex = luax_checktexture(L, 4);
luax_catchexcept(L, [&]() { instance()->drawShaderVertices(primtype, vertexcount, instancecount, tex); });
}
return 0;
}
int w_print(lua_State *L)
{
std::vector<Font::ColoredString> str;
@@ -3441,7 +3483,7 @@ int w_push(lua_State *L)
if (luax_istype(L, 2, math::Transform::type))
{
math::Transform *t = luax_totype<math::Transform>(L, 2);
luax_catchexcept(L, [&]() { instance()->applyTransform(t); });
luax_catchexcept(L, [&]() { instance()->applyTransform(t->getMatrix()); });
}
return 0;
@@ -3492,15 +3534,19 @@ int w_origin(lua_State * /*L*/)
int w_applyTransform(lua_State *L)
{
math::Transform *t = math::luax_checktransform(L, 1);
luax_catchexcept(L, [&]() { instance()->applyTransform(t); });
luax_checkstandardtransform(L, 1, [&](const Matrix4 &m)
{
luax_catchexcept(L, [&]() { instance()->applyTransform(m); });
});
return 0;
}
int w_replaceTransform(lua_State *L)
{
math::Transform *t = math::luax_checktransform(L, 1);
luax_catchexcept(L, [&]() { instance()->replaceTransform(t); });
luax_checkstandardtransform(L, 1, [&](const Matrix4 &m)
{
luax_catchexcept(L, [&]() { instance()->replaceTransform(m); });
});
return 0;
}
@@ -3610,6 +3656,7 @@ static const luaL_Reg functions[] =
{ "draw", w_draw },
{ "drawLayer", w_drawLayer },
{ "drawInstanced", w_drawInstanced },
{ "drawShaderVertices", w_drawShaderVertices },
{ "print", w_print },
{ "printf", w_printf },
@@ -3630,6 +3677,7 @@ static const luaL_Reg functions[] =
{ "getPixelHeight", w_getPixelHeight },
{ "getPixelDimensions", w_getPixelDimensions },
{ "getDPIScale", w_getDPIScale },
{ "getQuadIndexBuffer", w_getQuadIndexBuffer },
{ "setScissor", w_setScissor },
{ "intersectScissor", w_intersectScissor },
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -3,7 +3,7 @@ R"luastring"--(
-- There is a matching delimiter at the bottom of the file.
--[[
Copyright (c) 2006-2021 LOVE Development Team
Copyright (c) 2006-2022 LOVE Development Team
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2021 LOVE Development Team
* Copyright (c) 2006-2022 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -3,7 +3,7 @@ R"luastring"--(
-- There is a matching delimiter at the bottom of the file.
--[[
Copyright (c) 2006-2021 LOVE Development Team
Copyright (c) 2006-2022 LOVE Development Team
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages