Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Macros in QRhi shaders?
Forum Updated to NodeBB v4.3 + New Features

Macros in QRhi shaders?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 73 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hamer
    wrote last edited by
    #1

    Hi,

    I need different code paths in a shader, for example:

    #ifdef QSHADER_GLSL
    layout(location = 0) in vec2 a_pos;
    #else
    layout(location = 0) in ivec2 a_pos_int;
    #endif
    

    I know that it is possible to manually define defines:

    qt6_add_shaders(my_target
        DEFINES "QSHADER_GLSL=true"
        FILES
            ...
    )
    

    But this way using qputenv("QSG_RHI_BACKEND", "opengl") does not work. Is there an alternative?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hamer
      wrote last edited by
      #2

      As usual, after asking the question, I found the answer myself. The key is to passPERTARGETCOMPILE to qt6_add_shaders.

      1 Reply Last reply
      0
      • H hamer has marked this topic as solved

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved