This plagued me for quite some time. I found two issues:
in developing a more complete deferred shading implementation with HDR, For some reason when using multiple texture samplers, sometimes BGFX does not bind the correct texture. to solve, from time to time I have to change the binding stage index to get the proper texture mapping to the shader sampler.
sampling my lum texture in the tone mapping shader/pass results in very wrong results during tonemapping, simply changing the shader model to 1.2 gives correct results. with 1.3 and above. I have tried with BGRA8 and f32/f16 lum textures. also sampling lum with .5, .5 delivers unreliable results vs using v_texcoord0 (lum texture is 1x1 pixels)
This plagued me for quite some time. I found two issues:
$input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4
/*
include "common.sh"
SAMPLER2D(s_texColor, 0); SAMPLER2D(s_texLum, 1); SAMPLER2D(s_texBlur, 2);
void main() { vec3 rgb = decodeRGBE8(texture2D(s_texColor, v_texcoord0) ); //float lum = clamp(decodeRE8(texelFetch(s_texLum, ivec2(gl_FragCoord.xy), 0) ), 0.1, 0.7); float lum = clamp(decodeRE8(texture2D(s_texLum, v_texcoord0)), 0.1, 0.7);
}