mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Vertex shaders can write to gl_PointSize (fixes #1603).
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
This commit is contained in:
@@ -1138,11 +1138,14 @@ Graphics::BatchedVertexData Graphics::requestBatchedDraw(const BatchedDrawComman
|
||||
state.standardShaderType = cmd.standardShaderType;
|
||||
}
|
||||
|
||||
if (state.vertexCount == 0 && Shader::isDefaultActive())
|
||||
Shader::attachDefault(state.standardShaderType);
|
||||
if (state.vertexCount == 0)
|
||||
{
|
||||
if (Shader::isDefaultActive())
|
||||
Shader::attachDefault(state.standardShaderType);
|
||||
|
||||
if (state.vertexCount == 0 && Shader::current != nullptr && cmd.texture != nullptr)
|
||||
Shader::current->checkMainTexture(cmd.texture);
|
||||
if (Shader::current != nullptr)
|
||||
Shader::current->validateDrawState(cmd.primitiveMode, cmd.texture);
|
||||
}
|
||||
|
||||
if (shouldresize)
|
||||
{
|
||||
@@ -1350,6 +1353,7 @@ void Graphics::points(const Vector2 *positions, const Colorf *colors, size_t num
|
||||
cmd.formats[0] = getSinglePositionFormat(is2D);
|
||||
cmd.formats[1] = CommonFormat::RGBAub;
|
||||
cmd.vertexCount = (int) numpoints;
|
||||
cmd.standardShaderType = Shader::STANDARD_POINTS;
|
||||
|
||||
BatchedVertexData data = requestBatchedDraw(cmd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user