Maximum Point Size Limits in GLSL

This article provides an overview of how point sizes are defined, controlled, and constrained in GLSL and the underlying OpenGL pipeline. While shaders set the desired point dimension using the built-in gl_PointSize variable, the actual rasterized dimension is constrained by hardware-dependent implementation constants. Below is a direct breakdown of how these limits are defined, queried, and enforced by the graphics pipeline.

Controlling Point Size in GLSL

In a GLSL vertex shader, point size is assigned directly through the built-in output variable gl_PointSize:

void main() {
    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    gl_PointSize = 64.0;
}

For the OpenGL pipeline to respect the value written to gl_PointSize, the client application must enable the program point size capability:

glEnable(GL_PROGRAM_POINT_SIZE);

If this capability is disabled, the rasterizer ignores gl_PointSize and defaults to the state set by glPointSize(size).

Implementation Constants Defining Limits

GLSL itself does not define fixed numerical limits for point size within the language grammar. Instead, the maximum and minimum values are dictated by the underlying hardware and the OpenGL/Vulkan implementation.

OpenGL exposes these limits to the client application via implementation constants:

  • GL_POINT_SIZE_RANGE / GL_ALIASED_POINT_SIZE_RANGE: Returns two values representing the minimum and maximum supported sizes for standard (aliased) points.
  • GL_SMOOTH_POINT_SIZE_RANGE: Returns two values representing the minimum and maximum supported sizes for antialiased points (used when GL_POINT_SMOOTH is active).
  • GL_POINT_SIZE_GRANULARITY: Returns the size step between adjacent supported point sizes.

Specification Requirements and Hardware Variances

The OpenGL specification sets baseline minimum requirements for implementations:

  • The minimum allowable point size must be at least 1.0.
  • The maximum allowable point size must be at least 1.0, though desktop specifications require implementations to support larger values.

In practice, maximum point sizes vary drastically depending on the GPU architecture, vendor, and driver:

  • Integrated GPUs & Mobile (OpenGL ES): Often cap maximum point size between 64.0 and 256.0 pixels.
  • Discrete Desktop GPUs (NVIDIA, AMD): Commonly support point sizes up to 1024.0, 2048.0, or higher.
  • Vulkan Equivalent: Vulkan exposes these bounds in the VkPhysicalDeviceLimits structure as pointSizeRange[2], where pointSizeRange[1] denotes the maximum.

Pipeline Clamping Behavior

If a GLSL vertex shader assigns a value to gl_PointSize that exceeds the maximum limit or falls below the minimum limit, the implementation clamps the value to the supported range. This clamping occurs during the rasterization stage and does not generate a GLSL compiler error or an OpenGL runtime error.

Querying Maximum Point Size

To prevent unexpected visual artifacts due to hardware clamping, applications should query the maximum supported point size on the host side:

GLfloat pointSizeRange[2];
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);

GLfloat minSize = pointSizeRange[0];
GLfloat maxSize = pointSizeRange[1];

The retrieved maxSize represents the absolute upper bound that can be effectively rasterized by passing values through gl_PointSize. When rendered points need to exceed this hardware limit, point sprites must typically be replaced with textured camera-facing quads (billboards) or instanced geometry.