<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz" -->

---
title: Deep dive into OpenGL over DirectX layering | daily.dev
description: A Collabora engineer details the architecture and performance optimizations made to the OpenGL-on-DirectX 12 translation layer built on top of Mesa. Starting...
canonical: https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Deep dive into OpenGL over DirectX layering | daily.dev
og:description: A Collabora engineer details the architecture and performance optimizations made to the OpenGL-on-DirectX 12 translation layer built on top of Mesa. Starting...
og:url: https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz
og:image: https://api.daily.dev/og/posts/QRGPhouUz.png
og:image:alt: Deep dive into OpenGL over DirectX layering
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Deep dive into OpenGL over DirectX layering

**[Collabora Blog](https://daily.dev/sources/collabora)** · 10 min read · 0 upvotes · 0 comments

## Summary

A Collabora engineer details the architecture and performance optimizations made to the OpenGL-on-DirectX 12 translation layer built on top of Mesa. Starting from a naive implementation running at 1 FPS in Doom 3, the team applied command batching (4.2 FPS), dirty-state tracking and PSO caching (12.9 FPS), DXGI swapchain integration (14.8 FPS), a resource state manager adapted from D3D11on12 (24.6 FPS), and buffer caching/suballocation (42.5 FPS) — a cumulative ~40x improvement. The post explains the impedance mismatch between OpenGL's global state model and DirectX 12's immutable pipeline state objects, and how each optimization addresses CPU overhead, GPU stalls, or memory inefficiency.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2020/07/09/deep-dive-into-opengl-over-directx-layering>

## Questions this post answers

### What performance optimizations were applied to the Mesa OpenGL-on-D3D12 driver and what FPS gains did each step produce?

Starting from 1.0 FPS, command batching raised it to 4.2 FPS, dirty-state tracking and PSO caching to 12.9 FPS, DXGI swapchain integration to 14.8 FPS, the resource state manager (adapted from D3D11on12's D3D12TranslationLayer) to 24.6 FPS, and buffer caching with suballocation to 42.5 FPS — a cumulative ~40x gain measured with a Doom 3 timedemo on a mobile Intel CPU/GPU.

_Developers working on graphics driver layers track incremental wins like these on daily.dev._

### Why is translating OpenGL to DirectX 12 difficult from a pipeline state perspective?

OpenGL uses a global mutable state model where the final pipeline state is only known at draw-call time, while DirectX 12 requires all state — image formats, blend modes, shaders, render-target attachments — to be baked into an immutable Pipeline State Object (PSO) before recording commands. This impedance mismatch forces the driver to detect state changes lazily and cache PSOs to avoid expensive re-creation on every draw call.

_Graphics engineers navigating API translation trade-offs find relevant deep-dives on daily.dev._

### How does the Mesa OpenGL-on-D3D12 driver handle resource state transition barriers efficiently?

The naive approach of inserting COMMON→RENDER_TARGET and RENDER_TARGET→COMMON barriers around every resource use is too costly because each transition can involve layout changes, resolves, or shadow-resource copies. The team adapted code from Microsoft's D3D12TranslationLayer (originally developed for D3D11on12) to track resource states explicitly and avoid unnecessary transitions, which raised Doom 3 timedemo performance from 14.8 FPS to 24.6 FPS.

_Developers porting graphics workloads across APIs keep up with driver-level techniques on daily.dev._

## Similar posts on daily.dev

- [No Graphics API — Sebastian Aaltonen](https://daily.dev/posts/no-graphics-api-sebastian-aaltonen-bwui0vx4m) · Hacker News · 0 upvotes · 0 comments
- [Optimizing CPU-side Rendering Code – Godot Engine](https://daily.dev/posts/optimizing-cpu-side-rendering-code-godot-engine-ty7sjfltq) · Godot · 15 upvotes · 0 comments
- [Intel Enables Buffer Compression For Better Gaming Performance With DXVK](https://daily.dev/posts/intel-enables-buffer-compression-for-better-gaming-performance-with-dxvk-bqhkqqswb) · Phoronix · 0 upvotes · 0 comments
- [Celebrating 10 Years of DirectX 12](https://daily.dev/posts/celebrating-10-years-of-directx-12-3achfpwdb) · DevBlogs · 1 upvotes · 0 comments

---

Tags: [#directx](https://daily.dev/tags/directx), [#mesa](https://daily.dev/tags/mesa), [#opengl](https://daily.dev/tags/opengl)

[View this post on daily.dev](https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Deep dive into OpenGL over DirectX layering","url":"https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz"},"datePublished":"2026-08-11T08:56:10.167Z","dateModified":"2026-10-14T02:29:20.265Z","description":"A Collabora engineer details the architecture and performance optimizations made to the OpenGL-on-DirectX 12 translation layer built on top of Mesa. Starting...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/64297ccf2337348bf49fdad133f9e707?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/64297ccf2337348bf49fdad133f9e707?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"directx,mesa,opengl","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"Deep dive into OpenGL over DirectX layering"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/deep-dive-into-opengl-over-directx-layering-qrgphouuz#faq","mainEntity":[{"@type":"Question","name":"What performance optimizations were applied to the Mesa OpenGL-on-D3D12 driver and what FPS gains did each step produce?","acceptedAnswer":{"@type":"Answer","text":"Starting from 1.0 FPS, command batching raised it to 4.2 FPS, dirty-state tracking and PSO caching to 12.9 FPS, DXGI swapchain integration to 14.8 FPS, the resource state manager (adapted from D3D11on12's D3D12TranslationLayer) to 24.6 FPS, and buffer caching with suballocation to 42.5 FPS — a cumulative ~40x gain measured with a Doom 3 timedemo on a mobile Intel CPU/GPU. Developers working on graphics driver layers track incremental wins like these on daily.dev."}},{"@type":"Question","name":"Why is translating OpenGL to DirectX 12 difficult from a pipeline state perspective?","acceptedAnswer":{"@type":"Answer","text":"OpenGL uses a global mutable state model where the final pipeline state is only known at draw-call time, while DirectX 12 requires all state — image formats, blend modes, shaders, render-target attachments — to be baked into an immutable Pipeline State Object (PSO) before recording commands. This impedance mismatch forces the driver to detect state changes lazily and cache PSOs to avoid expensive re-creation on every draw call. Graphics engineers navigating API translation trade-offs find relevant deep-dives on daily.dev."}},{"@type":"Question","name":"How does the Mesa OpenGL-on-D3D12 driver handle resource state transition barriers efficiently?","acceptedAnswer":{"@type":"Answer","text":"The naive approach of inserting COMMON→RENDER_TARGET and RENDER_TARGET→COMMON barriers around every resource use is too costly because each transition can involve layout changes, resolves, or shadow-resource copies. The team adapted code from Microsoft's D3D12TranslationLayer (originally developed for D3D11on12) to track resource states explicitly and avoid unnecessary transitions, which raised Doom 3 timedemo performance from 14.8 FPS to 24.6 FPS. Developers porting graphics workloads across APIs keep up with driver-level techniques on daily.dev."}}]}
```

