<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Macros in QRhi shaders?]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I need different code paths in a shader, for example:</p>
<pre><code>#ifdef QSHADER_GLSL
layout(location = 0) in vec2 a_pos;
#else
layout(location = 0) in ivec2 a_pos_int;
#endif
</code></pre>
<p dir="auto">I know that it is possible to manually define defines:</p>
<pre><code>qt6_add_shaders(my_target
    DEFINES "QSHADER_GLSL=true"
    FILES
        ...
)
</code></pre>
<p dir="auto">But this way using <code>qputenv("QSG_RHI_BACKEND", "opengl")</code> does not work. Is there an alternative?</p>
]]></description><link>https://forum.qt.io/topic/163092/macros-in-qrhi-shaders</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 14:39:08 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/163092.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Aug 2025 05:41:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Macros in QRhi shaders? on Thu, 28 Aug 2025 05:48:21 GMT]]></title><description><![CDATA[<p dir="auto">As usual, after asking the question, I found the answer myself. The key is to pass<code>PERTARGETCOMPILE</code> to <code>qt6_add_shaders</code>.</p>
]]></description><link>https://forum.qt.io/post/830949</link><guid isPermaLink="true">https://forum.qt.io/post/830949</guid><dc:creator><![CDATA[hamer]]></dc:creator><pubDate>Thu, 28 Aug 2025 05:48:21 GMT</pubDate></item></channel></rss>