Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
glslでビット演算を実行するにはどうすればよいですか?
通常のCスタイルのビット演算子、、、、またはを使用|して&も機能しません。 ^!
|
&
^
!
これらは GLSL 1.30 (OGL 3.0) で導入されました。
やりたいことに応じて、x & (2^n)-1 = frac(x/(2^n))*(2^n)たとえば浮動小数点演算で最終的にエミュレートできますが、浮動小数点エラーに注意する必要があります。
x & (2^n)-1 = frac(x/(2^n))*(2^n)
どちらかを入れる必要があります
#version 130
また
#extension GL_EXT_gpu_shader4 : enable
シェーダーの上部にあるビット演算子にアクセスする