bitwise operator not supported?

Recommended Posts

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?

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

@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

Share this post

Link to post
Share on other sites

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 by ivan.popelyshev

Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.