Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 9f6aff9

Browse files
committed
Histogram monitor should work on Android/GLES3 now
1 parent 01bd4d8 commit 9f6aff9

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

PostProcessing/Shaders/Debug/Histogram.shader

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Shader "Hidden/PostProcessing/Debug/Histogram"
22
{
33
HLSLINCLUDE
44

5-
#pragma exclude_renderers gles gles3
65
#pragma target 4.5
76
#include "../StdLib.hlsl"
87

@@ -46,19 +45,29 @@ Shader "Hidden/PostProcessing/Debug/Histogram"
4645
o.texcoord = o.texcoord * float2(1.0, -1.0) + float2(0.0, 1.0);
4746
#endif
4847

48+
#if SHADER_API_GLES3 // No texture loopup in VS on GLES3/Android
49+
o.maxValue = 0;
50+
#else
4951
o.maxValue = _Params.y / FindMaxHistogramValue();
52+
#endif
5053

5154
return o;
5255
}
5356

5457
float4 Frag(VaryingsHistogram i) : SV_Target
5558
{
59+
#if SHADER_API_GLES3
60+
float maxValue = _Params.y / FindMaxHistogramValue();
61+
#else
62+
float maxValue = i.maxValue;
63+
#endif
64+
5665
const float kBinsMinusOne = HISTOGRAM_BINS - 1.0;
5766
float remapI = i.texcoord.x * kBinsMinusOne;
5867
uint index = floor(remapI);
5968
float delta = frac(remapI);
60-
float v1 = float(_HistogramBuffer[index]) * i.maxValue;
61-
float v2 = float(_HistogramBuffer[min(index + 1, kBinsMinusOne)]) * i.maxValue;
69+
float v1 = float(_HistogramBuffer[index]) * maxValue;
70+
float v2 = float(_HistogramBuffer[min(index + 1, kBinsMinusOne)]) * maxValue;
6271
float h = v1 * (1.0 - delta) + v2 * delta;
6372
uint y = (uint)round(i.texcoord.y * _Params.y);
6473

0 commit comments

Comments
 (0)