| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #include "$ENGINE$\PPBase.bslinc"
- Parameters =
- {
- Texture2D gHistogramTex;
- Texture2D gEyeAdaptationTex;
- };
- Blocks =
- {
- Block Input;
- };
- Technique : inherits("PPBase") =
- {
- Language = "HLSL11";
-
- Pass =
- {
- Fragment =
- {
- cbuffer Input
- {
- uint gThreadGroupCount;
- }
-
- Texture2D gHistogramTex;
- Texture2D gEyeAdaptationTex;
- float4 main(VStoFS input) : SV_Target0
- {
- int2 iUV = trunc(input.uv0);
- float4 outputValue = 0.0f;
- // Output texture only has two rows, store histogram on the first
- if(input.uv0.y < 1.0f)
- {
- // TODO - Potentially optimize using bilinear filtering
- for(uint i = 0; i < gThreadGroupCount; i++)
- outputValue += gHistogramTex.Load(int3(iUV.x, i, 0));
- return outputValue / gThreadGroupCount;
- }
- else
- {
- // Store eye adaptation from last frame in the second row of the texture
- return gEyeAdaptationTex.Load(int3(0, 0, 0)).x;
- }
- }
- };
- };
- };
- Technique : inherits("PPBase") =
- {
- Language = "GLSL";
-
- Pass =
- {
- Fragment =
- {
- in VStoFS
- {
- vec2 uv0;
- } input;
-
- uniform Input
- {
- uint gThreadGroupCount;
- };
-
- uniform sampler2D gHistogramTex;
- uniform sampler2D gEyeAdaptationTex;
- out vec4 fragColor;
-
- void main()
- {
- ivec2 iUV = ivec2(trunc(input.uv0));
- vec4 outputValue = vec4(0.0f);
- // Output texture only has two rows, store histogram on the first
- if(input.uv0.y < 1.0f)
- {
- // TODO - Potentially optimize using bilinear filtering
- for(uint i = 0; i < gThreadGroupCount; i++)
- outputValue += texelFetch(gHistogramTex, ivec2(iUV.x, i), 0);
- fragColor = outputValue / gThreadGroupCount;
- }
- else
- {
- // Store eye adaptation from last frame in the second row of the texture
- fragColor = texelFetch(gEyeAdaptationTex, ivec2(0, 0), 0).xxxx;
- }
- }
- };
- };
- };
|