<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co" -->

---
title: Oh boy, another SPIR-V bug! :D | daily.dev
description: A live-coding stream chronicles debugging a homegrown SVG renderer written in Zig as its author attempts to port the CPU rendering pipeline to the GPU via...
canonical: https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Oh boy, another SPIR-V bug! :D | daily.dev
og:description: A live-coding stream chronicles debugging a homegrown SVG renderer written in Zig as its author attempts to port the CPU rendering pipeline to the GPU via...
og:url: https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co
og:image: https://api.daily.dev/og/posts/7M3vpa8cO.png
og:image:alt: Oh boy, another SPIR-V bug! :D
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.

# Oh boy, another SPIR-V bug! :D

**[sphaerophoria](https://daily.dev/sources/sphaerophoria)** · 119 min read · 0 upvotes · 0 comments

## Summary

A live-coding stream chronicles debugging a homegrown SVG renderer written in Zig as its author attempts to port the CPU rendering pipeline to the GPU via SPIR-V. The core rendering algorithm uses scanline winding-count detection across path contours to determine fill regions. When porting to GPU shaders, the streamer hits a SPIR-V validator error tied to using OpBitcast on a pointer inside a tagged union, then works through SPIR-V spec rules, validator source code, and community help to isolate that OpBitcast does not produce a valid logical variable pointer for OpStore, unlike whitelisted instructions such as OpAccessChain. The stream ends mid-investigation, having identified the likely root cause but not yet a fix.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=i1pCCHMiT2g>

## Questions this post answers

### Why does SPIR-V's validator reject an OpStore after using OpBitcast to cast a pointer inside a union in Zig's SPIR-V backend?

OpBitcast on a pointer does not produce a logical variable pointer, and OpStore under the logical addressing model requires the destination pointer to originate from a whitelisted instruction such as OpAccessChain or OpVariable. Because OpBitcast is not on that whitelist, storing through a bitcast pointer to a union field (e.g. reinterpreting an F64 pointer as U64) fails validation even with the variable pointers extension enabled.

_Anyone porting Zig or other language backends to SPIR-V can track deep compiler internals fixes like this on daily.dev._

### What technique is used to fill complex SVG paths with multiple contours when rendering with a scanline algorithm?

Each pixel row is scanned and crossings of contour edges are counted with a signed winding count: crossing one direction adds one, the opposite direction subtracts one. A point is filled when the accumulated winding count is non-zero. To handle sub-pixel precision, crossings are tracked separately on the top and bottom edges of each pixel and paired as inward/outward crosses before being converted into winding changes.

_Developers building custom vector graphics renderers can find deep dives like this scanline winding approach on daily.dev._

## Similar posts on daily.dev

- [Killing what can't be handled – putting a spaghetti demon to eternal rest](https://daily.dev/posts/killing-what-can-t-be-handled-putting-a-spaghetti-demon-to-eternal-rest-d72qiilkh) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#gpu](https://daily.dev/tags/gpu), [#zig](https://daily.dev/tags/zig), [#vulkan](https://daily.dev/tags/vulkan)

[View this post on daily.dev](https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co)

```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":"Oh boy, another SPIR-V bug! :D","url":"https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co"},"datePublished":"2026-08-27T00:35:22.904Z","dateModified":"2026-08-27T01:01:15.330Z","description":"A live-coding stream chronicles debugging a homegrown SVG renderer written in Zig as its author attempts to port the CPU rendering pipeline to the GPU via...","image":"https://i.ytimg.com/vi/i1pCCHMiT2g/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/i1pCCHMiT2g/sddefault.jpg","isAccessibleForFree":true,"articleSection":"sphaerophoria","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":"sphaerophoria","logo":"https://media.daily.dev/image/upload/s--dgPUg2T7--/f_auto/v1728806109/logos/sphaerophoria","url":"https://daily.dev/sources/sphaerophoria"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"gpu,zig,vulkan","timeRequired":"PT119M","video":{"@type":"VideoObject","name":"Oh boy, another SPIR-V bug! :D","description":"A live-coding stream chronicles debugging a homegrown SVG renderer written in Zig as its author attempts to port the CPU rendering pipeline to the GPU via...","thumbnailUrl":"https://i.ytimg.com/vi/i1pCCHMiT2g/sddefault.jpg","uploadDate":"2026-08-27T00:35:22.904Z","duration":"PT119M","url":"https://api.daily.dev/r/7M3vpa8cO","embedUrl":"https://www.youtube.com/embed/i1pCCHMiT2g"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"sphaerophoria","item":"https://daily.dev/sources/sphaerophoria"},{"@type":"ListItem","position":3,"name":"Oh boy, another SPIR-V bug! :D"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/oh-boy-another-spir-v-bug-d-7m3vpa8co#faq","mainEntity":[{"@type":"Question","name":"Why does SPIR-V's validator reject an OpStore after using OpBitcast to cast a pointer inside a union in Zig's SPIR-V backend?","acceptedAnswer":{"@type":"Answer","text":"OpBitcast on a pointer does not produce a logical variable pointer, and OpStore under the logical addressing model requires the destination pointer to originate from a whitelisted instruction such as OpAccessChain or OpVariable. Because OpBitcast is not on that whitelist, storing through a bitcast pointer to a union field (e.g. reinterpreting an F64 pointer as U64) fails validation even with the variable pointers extension enabled. Anyone porting Zig or other language backends to SPIR-V can track deep compiler internals fixes like this on daily.dev."}},{"@type":"Question","name":"What technique is used to fill complex SVG paths with multiple contours when rendering with a scanline algorithm?","acceptedAnswer":{"@type":"Answer","text":"Each pixel row is scanned and crossings of contour edges are counted with a signed winding count: crossing one direction adds one, the opposite direction subtracts one. A point is filled when the accumulated winding count is non-zero. To handle sub-pixel precision, crossings are tracked separately on the top and bottom edges of each pixel and paired as inward/outward crosses before being converted into winding changes. Developers building custom vector graphics renderers can find deep dives like this scanline winding approach on daily.dev."}}]}
```

