Skip to content

Instantly share code, notes, and snippets.

View loopervfx's full-sized avatar
Focusing

Landon Looper loopervfx

Focusing
View GitHub Profile
These generalistions about never using conditionals in GPU code are misleading, anyway. Just be careful about using conditionals
so that your thread groups are mostly either true or false. like checking a UV coord on a 2D frag/pixel shader
e.g. if (uv.x < 0.53) and branching in a clean cut through the texture or screenspace coordinates, is no problem on modern GPUs.
Because only a few thread groups in the dispatch "grid" might get held up --the ones that have a mix of true/false threads around
the 0.53 coord.
The situation to watch out for is doing something like, a conditional to check for even or odd texel coords or a conditional
with some pseudo random determination which means every thread group will have a heterogeneous mix of true/false
and every thread group in the dispatch will be held up taking the time to execute both conditions.
@loopervfx
loopervfx / TouchdesignerPerlinSimplexNoise.glsl
Created June 11, 2019 03:30
Touchdesigner perlin + simplex noise
#version 330
#extension GL_NV_gpu_shader5 : enable
#extension GL_NV_bindless_texture : enable
#extension GL_ARB_shading_language_include : enable
/** BEGIN TD COMMON UTIL UNIFORMS Garbagesdmwk7**/
uniform sampler2D sTDNoiseMap;
uniform sampler1D sTDSineLookup;
uniform sampler2D sTDWhite2D;
uniform sampler3D sTDWhite3D;
uniform sampler2DArray sTDWhite2DArray;