diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-12 17:52:04 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-12 17:52:04 +0100 |
commit | 98b2fed85fd459012ed2b859ea40a3f56d27c0e8 (patch) | |
tree | 74c478cf0c9526d382cbaae00c0bc6f13d5968b1 /indra/llrender | |
parent | cf460b13bee894684d0ca1bcb5bbc9eb38df719c (diff) |
De-duplicate shader code for encoding and decoding normals to/from gbuffer format.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 6bea2e7a76..73ab95cf3b 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -85,6 +85,8 @@ LLShaderFeatures::LLShaderFeatures() , hasAtmospherics(false) , hasGamma(false) , hasSrgb(false) + , encodesNormal(false) + , decodesNormal(false) , mIndexedTextureChannels(0) , disableTextureIndex(false) , hasAlphaMask(false) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index b6c54a0bf8..562cbdcba9 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -49,6 +49,8 @@ public: bool hasAtmospherics; bool hasGamma; bool hasSrgb; + bool encodesNormal; + bool decodesNormal; S32 mIndexedTextureChannels; bool disableTextureIndex; bool hasAlphaMask; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 6c816d0dc4..3bac545b5f 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -213,6 +213,22 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } + if (features->encodesNormal) + { + if (!shader->attachObject("environment/encodeNormF.glsl")) + { + return FALSE; + } + } + + if (features->decodesNormal) + { + if (!shader->attachObject("environment/decodeNormF.glsl")) + { + return FALSE; + } + } + if (features->hasAtmospherics) { if (!shader->attachObject("windlight/atmosphericsF.glsl")) |