Class GraphicsConfig

java.lang.Object
dev.engine.graphics.GraphicsConfig
Direct Known Subclasses:
GraphicsConfigLegacy, OpenGlConfig, VulkanConfig, WebGpuConfig

public abstract class GraphicsConfig extends Object
Base class for graphics backend configuration. Each backend extends this with backend-specific settings while inheriting common configuration.

Common settings apply across all backends. Backend-specific subclasses add their own settings (present mode for Vulkan, etc.) and implement createDevice(WindowHandle) to construct the appropriate render device.

// OpenGL with defaults
var gfx = new OpenGlConfig(toolkit, glBindings);

// Vulkan with specific settings
var gfx = VulkanConfig.builder(toolkit, vkBindings, surfaceCreator)
    .presentMode(VulkanConfig.PresentMode.MAILBOX)
    .validation(true)
    .build();
  • Constructor Details

    • GraphicsConfig

      protected GraphicsConfig(WindowToolkit toolkit)
  • Method Details

    • toolkit

      public WindowToolkit toolkit()
      The window toolkit used for window creation.
    • headless

      public boolean headless()
      Whether this is a headless (offscreen) configuration.
    • validation

      public boolean validation()
      Whether to enable backend validation layers (Vulkan validation, WebGPU error reporting).
    • presentMode

      public PresentMode presentMode()
      The present mode (vsync behavior).
    • msaaSamples

      public int msaaSamples()
      MSAA sample count (1 = disabled, 2/4/8 = multisampled).
    • srgb

      public boolean srgb()
      Whether to use sRGB framebuffer.
    • maxAnisotropy

      public float maxAnisotropy()
      Maximum anisotropic filtering level (1 = disabled).
    • headless

      public GraphicsConfig headless(boolean headless)
    • validation

      public GraphicsConfig validation(boolean validation)
    • presentMode

      public GraphicsConfig presentMode(PresentMode presentMode)
    • msaaSamples

      public GraphicsConfig msaaSamples(int samples)
    • srgb

      public GraphicsConfig srgb(boolean srgb)
    • maxAnisotropy

      public GraphicsConfig maxAnisotropy(float aniso)
    • create

      public final GraphicsBackend create(WindowDescriptor window)
      Creates the complete backend infrastructure: window + render device. Called by the engine during initialization.
    • createDevice

      protected abstract RenderDevice createDevice(WindowHandle window)
      Creates the backend-specific render device for the given window. Implemented by each backend config.