XHH Posted October 25, 2019 Share Posted October 25, 2019 I'm trying to use '>>' and '&' in fragment code for a Filter. It said bit-wise operator supported in GLSL ES 3.00 and above only". I tried adding "#version 300 es" to the top of my fragment shader code, but it keeps giving me "#version directive must occur before anything else, except for comments and white space" (it's at the very top, without any white space too) How can I enable bitwise operators? Or is there an alternative? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 25, 2019 Share Posted October 25, 2019 Its a known issue, we have a preprocessor that adds "precision float " in the beginning , so please make sure you specify that line at the first symbol and not after "\n" That wont work: const frag = ` #version ... `; that'll work: const frag = `#version 300 es ... `; The place in source code: https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/shader/Program.js#L53 Yes, we cant decide what to do with that thing for several months already. XHH and 128p 1 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 25, 2019 Share Posted October 25, 2019 I've put this solution here: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#shaders , i dont know why wasnt it mentioned in the docs. 128p 1 Quote Link to comment Share on other sites More sharing options...
Yuca Posted July 5, 2020 Share Posted July 5, 2020 @ivan.popelyshev, the solution provided does not work, also the link https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/shader/Program.js#L53 is broken (although not a big issue as the path stay correct). There is a warning in the browser that is -probably- showing the resulting shader: precision mediump float; #define SHADER_NAME pixi-shader-6 #version 200 es void main() { gl_FragColor = vec4(.0,.0,1.0,1.0); } As you can see, the version pre-processor is in third position.... Using pixi 5.2.4 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 9, 2020 Share Posted July 9, 2020 (edited) We moved typescript, so all links have to be to "ts" files and not "js" Works for me : https://www.pixiplayground.com/#/edit/_QFEUwXMSq7g_7Wqjisil did you removv extra line break in the beginning? That's exactly why I put it in wiki. Edited July 9, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
ikaruga Posted May 28, 2022 Share Posted May 28, 2022 I'm still getting this issue. I'm using Pixi.js 6.2.2 and loading the fragement with Filter. const filter = new Filter(undefined, frag, { ...(uniformsRef.current ?? {}), }); where `frag` does *not* have an extra line. See here: https://github.com/pixijs/pixijs/issues/8217#issuecomment-1140106817 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.