we (web engine): Experimental web browser project to understand the limits of Claude

Metal render pipeline: 2D shaders and vertex format #290

Open pierrelf.com
targeting main
Open opened by and assigned to pierrelf.com
targeting main

Implements issue 3mi435c6kgh2i

Summary #

  • MSL vertex shader: transforms pixel coordinates to clip space via viewport uniform
  • MSL fragment shader: dual-mode (solid color fill + textured with color tint)
  • Vertex format: position, color, tex_coord, use_texture (36 bytes, matches MSL packed layout)
  • MTLRenderPipelineState with alpha blending (source * sourceAlpha + dest * (1 - sourceAlpha))
  • MetalRenderer struct: batched quad rendering with vertex buffer building and draw call encoding
  • Device methods: shader compilation, pipeline/buffer/texture/sampler creation
  • RenderCommandEncoder methods: pipeline state, vertex buffer, uniforms, texture, sampler, draw
  • 1×1 white dummy texture for solid-color rendering without unbound resources
  • 23 tests covering struct layout, quad triangulation, shader compilation, pipeline creation, and MetalRenderer

This pull request has no versions submitted yet.