<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://xgamedev.net/</id>
    <title>$locale:siteConfig.title</title>
    <updated>2025-10-13T02:06:54.009Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <author>
        <name>$locale:siteConfig.name</name>
        <email>jason@xgamedev.net</email>
        <uri>https://xgamedev.net/</uri>
    </author>
    <link rel="alternate" href="https://xgamedev.net/"/>
    <link rel="self" href="https://xgamedev.net/atom.xml"/>
    <subtitle>$locale:siteConfig.description</subtitle>
    <logo>https://avatars.githubusercontent.com/u/48086348?v=4</logo>
    <icon>https://xgamedev.net/favicon.svg</icon>
    <rights>CC BY-SA 4.0 2025 © $locale:siteConfig.name</rights>
    <entry>
        <title type="html"><![CDATA[Profiling Source Generator Performance]]></title>
        <id>https://xgamedev.net/posts/profile-source-generator/index</id>
        <link href="https://xgamedev.net/posts/profile-source-generator/index"/>
        <updated>2025-10-13T04:05:46.000Z</updated>
        <content type="html"><![CDATA[<h2>Preface {lang=&quot;en&quot;}</h2>
<h2>前文 {lang=&quot;zh-CN&quot;}</h2>
<p>::: en<br>
Source Generators in C# are a powerful feature that allows generating code at compile-time. However, when a Source Generator takes too long to execute, it can significantly slow down the build process. In this article, I'll share how to profile Source Generator performance using <strong>MSBuildStructuredLog</strong> and <strong>JetBrains dotTrace</strong> to identify performance bottlenecks.</p>
<p>The core idea is to manually invoke the C# compiler (csc) to compile <strong>a project that uses the Source Generator you want to profile</strong>. By using dotTrace to profile this compilation process, we can see the execution time of each function <strong>within the Source Generator itself</strong>. This allows us to pinpoint exactly which parts of the generator are causing performance issues.<br>
:::</p>
<p>::: zh-CN<br>
C# 的 Source Generator 是一个强大的功能，允许在编译时生成代码。然而，当 Source Generator 执行时间过长时，会显著拖慢构建过程。本文将分享如何使用 <strong>MSBuildStructuredLog</strong> 和 <strong>JetBrains dotTrace</strong> 来分析 Source Generator 的性能，从而找出性能瓶颈。</p>
<p>主要思路是手动调用 C# 的编译器（csc）去编译<strong>一个使用了你想要分析性能的 Source Generator 的工程</strong>。通过用 dotTrace 去分析这个编译进程，我们可以看到 <strong>Source Generator 本身内部</strong>每个函数的耗时。这样就能精确定位生成器中哪些部分导致了性能问题。<br>
:::</p>
<br/><p>Visit <a href="https://xgamedev.net/posts/profile-source-generator/index" target="_blank">https://xgamedev.net/posts/profile-source-generator/index</a> to read more.</p>]]></content>
        <author>
            <name>$locale:siteConfig.name</name>
            <email>jason@xgamedev.net</email>
            <uri>https://xgamedev.net/</uri>
        </author>
        <published>2025-10-13T02:04:20.612Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Implementing an Image Glow Effect in URP]]></title>
        <id>https://xgamedev.net/posts/glow/index</id>
        <link href="https://xgamedev.net/posts/glow/index"/>
        <updated>2024-10-05T13:04:57.000Z</updated>
        <content type="html"><![CDATA[<h2>Preface {lang=&quot;en&quot;}</h2>
<h2>前文 {lang=&quot;zh-CN&quot;}</h2>
<p>::: en<br>
I've been working on a project recently that required glow effects for 2D weapons. After implementing a simple solution, I'd like to share the approach and code in this article.<br>
:::</p>
<p>::: zh-CN<br>
最近在搞一个项目，需要给2D武器做发光特效，于是简单的搞了一下，并在本文分享一下思路和代码<br>
:::</p>
<h2>Prototype {lang=&quot;en&quot;}</h2>
<h2>雏形 {lang=&quot;zh-CN&quot;}</h2>
<p>::: en<br>
Let's start by creating a fragment shader. Note that this shader supports:</p>
<ul>
<li>Transparency (Transparent)</li>
<li>Custom color blending (Blend)</li>
<li>SRP Batcher batching (CBuffer)<br>
:::</li>
</ul>
<p>::: zh-CN<br>
我们先创建一个片元着色器，注意，这个Shader支持：</p>
<ul>
<li>透明（Transparent）</li>
<li>自定义颜色混合（Blend）</li>
<li>SRP Batcher合批（CBuffer）<br>
:::</li>
</ul>
<br/><p>Visit <a href="https://xgamedev.net/posts/glow/index" target="_blank">https://xgamedev.net/posts/glow/index</a> to read more.</p>]]></content>
        <author>
            <name>$locale:siteConfig.name</name>
            <email>jason@xgamedev.net</email>
            <uri>https://xgamedev.net/</uri>
        </author>
        <published>2025-10-13T02:04:20.605Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Mitigate Crash When Converting Binary Data to Structures in C# on 32-bit Platforms]]></title>
        <id>https://xgamedev.net/posts/csharp-32bit-crash/index</id>
        <link href="https://xgamedev.net/posts/csharp-32bit-crash/index"/>
        <updated>2025-07-19T09:08:41.000Z</updated>
        <content type="html"><![CDATA[<h2>Preface {lang=&quot;en&quot;}</h2>
<h2>前文 {lang=&quot;zh-CN&quot;}</h2>
<p>::: en<br>
Recently, a friend reported that my open-source <strong>high-performance C# binary serialization library</strong> <a href="https://github.com/JasonXuDeveloper/Nino">Nino</a> would crash on 32-bit platforms (such as armv7 android application built by Unity). I then tracked down and fixed the issue in <a href="https://github.com/JasonXuDeveloper/Nino/commit/39bfde9baae1932e690e2a54f61794641a3275d6">this commit</a>.</p>
<p>As of the publication of this article, this issue exists in many well-known serialization libraries, such as <a href="https://github.com/Cysharp/MemoryPack">MemoryPack</a> and <a href="https://github.com/MessagePack-CSharp/MessagePack-CSharp">MessagePack</a>. In this article, I will share the cause of the issue and the solution.<br>
:::</p>
<p>::: zh-CN<br>
最近，有朋友反馈了我开源的<strong>高性能C#二进制序列化库</strong> <a href="https://github.com/JasonXuDeveloper/Nino">Nino</a> 会在32位平台（比如Unity编译出来的armv7安卓应用）出现闪退，随后我对该问题进行了定位和<a href="https://github.com/JasonXuDeveloper/Nino/commit/39bfde9baae1932e690e2a54f61794641a3275d6">修复</a>。</p>
<p>截止到本文发布，这个问题在很多知名序列化库中都存在，例如<a href="https://github.com/Cysharp/MemoryPack">MemoryPack</a>和<a href="https://github.com/MessagePack-CSharp/MessagePack-CSharp">MessagePack</a>，本文分享该问题的原因和修复方法。</p>
<p>:::</p>
<br/><p>Visit <a href="https://xgamedev.net/posts/csharp-32bit-crash/index" target="_blank">https://xgamedev.net/posts/csharp-32bit-crash/index</a> to read more.</p>]]></content>
        <author>
            <name>$locale:siteConfig.name</name>
            <email>jason@xgamedev.net</email>
            <uri>https://xgamedev.net/</uri>
        </author>
        <published>2025-10-13T02:04:20.438Z</published>
    </entry>
</feed>