From ed1b78e32235680c3978b9830e5ba81115a0ab7d Mon Sep 17 00:00:00 2001 From: Jonathan Goodman Date: Tue, 28 Aug 2012 10:33:32 -0400 Subject: Added support for adding custom preprocessor definitions (for shader permutations) --- indra/llrender/llglslshader.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 5c68cb46eb..bee5d9adda 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -123,6 +123,8 @@ public: GLint getAttribLocation(U32 attrib); GLint mapUniformTextureChannel(GLint location, GLenum type); + void addPermutation(std::string name, std::string value); + //enable/disable texture channel for specified uniform //if given texture uniform is active in the shader, //the corresponding channel will be active upon return @@ -153,6 +155,7 @@ public: LLShaderFeatures mFeatures; std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; + std::map mDefines; }; //UI shader (declared here so llui_libtest will link properly) -- cgit v1.2.3 From 99371f892e7b35739be01e63036b4355e0e4dfe7 Mon Sep 17 00:00:00 2001 From: Jonathan Goodman Date: Tue, 28 Aug 2012 14:44:28 -0400 Subject: Added new bindTexture and unbindTexture API to LLGLSLShader. Reviewed by davep. --- indra/llrender/llglslshader.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index bee5d9adda..185e6e7aeb 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -130,7 +130,14 @@ public: //the corresponding channel will be active upon return //returns channel texture is enabled in from [0-MAX) S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); - S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + + // bindTexture returns the texture unit we've bound the texture to. + // You can reuse the return value to unbind a texture when required. + S32 bindTexture(const std::string& uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 unbindTexture(const std::string& uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 unbindTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); BOOL link(BOOL suppress_errors = FALSE); void bind(); -- cgit v1.2.3 From e606677ed885c4e9189b0768b5e6f999fa2cf885 Mon Sep 17 00:00:00 2001 From: Jonathan Goodman Date: Wed, 29 Aug 2012 04:56:54 -0400 Subject: Added the ability to remove a preprocessor define. --- indra/llrender/llglslshader.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 185e6e7aeb..f511c39484 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -124,6 +124,7 @@ public: GLint mapUniformTextureChannel(GLint location, GLenum type); void addPermutation(std::string name, std::string value); + void removePermutation(std::string name); //enable/disable texture channel for specified uniform //if given texture uniform is active in the shader, -- cgit v1.2.3 From d5b45b0b636557333c3408e7a60d5ef587ea99ad Mon Sep 17 00:00:00 2001 From: Jonathan Goodman Date: Wed, 29 Aug 2012 08:02:46 -0400 Subject: Use an unordered map for custom #defines instead of a map. Lookups are faster, and we don't really care about any particular order anyways for these. --- indra/llrender/llglslshader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index f511c39484..2af74c20ff 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -163,7 +163,7 @@ public: LLShaderFeatures mFeatures; std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; - std::map mDefines; + boost::unordered_map mDefines; }; //UI shader (declared here so llui_libtest will link properly) -- cgit v1.2.3 From c355fb98d3f4040196b7b8586dc9328fccb906d2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 06:12:50 +0000 Subject: Extracted texture baking system into llappearance library. --- indra/llrender/llglslshader.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 5c68cb46eb..cf21101e35 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -159,6 +159,8 @@ public: extern LLGLSLShader gUIProgram; //output vec4(color.rgb,color.a*tex0[tc0].a) extern LLGLSLShader gSolidColorProgram; +//Alpha mask shader (declared here so llappearance can access properly) +extern LLGLSLShader gAlphaMaskProgram; #endif -- cgit v1.2.3 From df08808640031bd27a11177ea49a08f797d2d570 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Thu, 28 Feb 2013 09:33:41 -0800 Subject: Improve perf of GLSL uniform lookups by name --- indra/llrender/llglslshader.h | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 5c68cb46eb..bac9af6959 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -75,16 +75,16 @@ public: static bool sNoFixedFunction; void unload(); - BOOL createShader(std::vector * attributes, - std::vector * uniforms, + BOOL createShader(std::vector * attributes, + std::vector * uniforms, U32 varying_count = 0, const char** varyings = NULL); BOOL attachObject(std::string object); void attachObject(GLhandleARB object); void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); - BOOL mapAttributes(const std::vector * attributes); - BOOL mapUniforms(const std::vector * uniforms); - void mapUniform(GLint index, const std::vector * uniforms); + BOOL mapAttributes(const std::vector * attributes); + BOOL mapUniforms(const std::vector *); + void mapUniform(GLint index, const std::vector *); void uniform1i(U32 index, GLint i); void uniform1f(U32 index, GLfloat v); void uniform2f(U32 index, GLfloat x, GLfloat y); @@ -95,29 +95,26 @@ public: void uniform2fv(U32 index, U32 count, const GLfloat* v); void uniform3fv(U32 index, U32 count, const GLfloat* v); void uniform4fv(U32 index, U32 count, const GLfloat* v); - void uniform1i(const std::string& uniform, GLint i); - void uniform1f(const std::string& uniform, GLfloat v); - void uniform2f(const std::string& uniform, GLfloat x, GLfloat y); - void uniform3f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z); - void uniform4f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void uniform1iv(const std::string& uniform, U32 count, const GLint* i); - void uniform1fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform2fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform3fv(const std::string& uniform, U32 count, const GLfloat* v); - void uniform4fv(const std::string& uniform, U32 count, const GLfloat* v); void uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); void uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix2fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); - void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v); + void uniform1i(const LLStaticHashedString& uniform, GLint i); + void uniform1f(const LLStaticHashedString& uniform, GLfloat v); + void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y); + void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z); + void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v); + void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v); void setMinimumAlpha(F32 minimum); void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void vertexAttrib4fv(U32 index, GLfloat* v); - GLint getUniformLocation(const std::string& uniform); + //GLint getUniformLocation(const std::string& uniform); + GLint getUniformLocation(const LLStaticHashedString& uniform); GLint getUniformLocation(U32 index); GLint getAttribLocation(U32 attrib); @@ -143,7 +140,7 @@ public: GLhandleARB mProgramObject; std::vector mAttribute; //lookup table of attribute enum to attribute channel std::vector mUniform; //lookup table of uniform enum to uniform location - std::map mUniformMap; //lookup map of uniform name to uniform location + LLStaticStringTable mUniformMap; //lookup map of uniform name to uniform location std::map mValue; //lookup map of uniform location to last known value std::vector mTexture; S32 mActiveTextureChannels; -- cgit v1.2.3 From dfda8826eb4654845430520dac48c011e058e1c0 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 1 Mar 2013 11:21:35 -0800 Subject: Make WL updates use pre-hashed strings for uniform sets --- indra/llrender/llglslshader.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index bac9af6959..619c3559ea 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -29,6 +29,7 @@ #include "llgl.h" #include "llrender.h" +#include "llstaticstringtable.h" class LLShaderFeatures { -- cgit v1.2.3 From bf6182daa8b4d7cea79310547f71d7a3155e17b0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 29 Mar 2013 07:50:08 -0700 Subject: Update Mac and Windows breakpad builds to latest --- indra/llrender/llglslshader.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/llrender/llglslshader.h (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h old mode 100644 new mode 100755 -- cgit v1.2.3 From 679a095aa04234f48c10139138ca54939099defa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 15:45:17 -0500 Subject: NORSPEC-74 Fix for assert when Debug GL enabled when rendering materials. --- indra/llrender/llglslshader.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 2af74c20ff..725a7e2573 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -152,6 +152,7 @@ public: GLhandleARB mProgramObject; std::vector mAttribute; //lookup table of attribute enum to attribute channel + U32 mAttributeMask; //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask()) std::vector mUniform; //lookup table of uniform enum to uniform location std::map mUniformMap; //lookup map of uniform name to uniform location std::map mValue; //lookup map of uniform location to last known value -- cgit v1.2.3 From 8025b8b2bc6028ed268e191d432cb3f740e351db Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 15 Apr 2013 13:16:14 -0500 Subject: NORSPEC-49 Add shader profiler, add support for ARB_depth_clamp where available --- indra/llrender/llglslshader.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 725a7e2573..d67ece018f 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -67,14 +67,29 @@ public: SG_WATER }; + static std::set sInstances; + static bool sProfileEnabled; + LLGLSLShader(); + ~LLGLSLShader(); static GLhandleARB sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; static S32 sIndexedTextureChannels; static bool sNoFixedFunction; + static void initProfile(); + static void finishProfile(); + + static void startProfile(); + static void stopProfile(U32 count, U32 mode); + void unload(); + void clearStats(); + void dumpStats(); + void placeProfileQuery(); + void readProfileQuery(U32 count, U32 mode); + BOOL createShader(std::vector * attributes, std::vector * uniforms, U32 varying_count = 0, @@ -157,6 +172,7 @@ public: std::map mUniformMap; //lookup map of uniform name to uniform location std::map mValue; //lookup map of uniform location to last known value std::vector mTexture; + S32 mTotalUniformSize; S32 mActiveTextureChannels; S32 mShaderLevel; S32 mShaderGroup; @@ -165,6 +181,17 @@ public: std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; boost::unordered_map mDefines; + + //statistcis for profiling shader performance + U32 mTimerQuery; + U64 mTimeElapsed; + static U64 sTotalTimeElapsed; + U32 mTrianglesDrawn; + static U32 sTotalTrianglesDrawn; + U64 mSamplesDrawn; + static U64 sTotalSamplesDrawn; + U32 mDrawCalls; + static U32 sTotalDrawCalls; }; //UI shader (declared here so llui_libtest will link properly) -- cgit v1.2.3 From abdbf45aaa05f201afd9e2f6c6be87150be2c890 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 20 May 2013 11:18:12 -0700 Subject: MAINT-2616 : Updated my Intel driver and now have orange in buttons and Inventory pull down bar causing blinks to screen. Pulled in FS code, Reviewed by Kelly --- indra/llrender/llglslshader.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 019d5a86d6..cd097b8e0b 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -160,5 +160,8 @@ extern LLGLSLShader gSolidColorProgram; //Alpha mask shader (declared here so llappearance can access properly) extern LLGLSLShader gAlphaMaskProgram; +// Solid color Shader for Intel Graphics +extern LLGLSLShader gSolidColorProgramIntel; + #endif -- cgit v1.2.3 From 473474b94969799d2835191072c5bca1b7d431d8 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 22 May 2013 16:51:42 -0700 Subject: Revert changes for MAINT-2616 due to licensing issues, need a full patch submitted to be acceptable --- indra/llrender/llglslshader.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index cd097b8e0b..019d5a86d6 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -160,8 +160,5 @@ extern LLGLSLShader gSolidColorProgram; //Alpha mask shader (declared here so llappearance can access properly) extern LLGLSLShader gAlphaMaskProgram; -// Solid color Shader for Intel Graphics -extern LLGLSLShader gSolidColorProgramIntel; - #endif -- cgit v1.2.3 From ccd04cd66c0a550694fefe41042ef47466780a92 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 18 Jun 2013 17:24:21 -0500 Subject: Occlusion culling overhaul. --- indra/llrender/llglslshader.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llrender/llglslshader.h') diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 3c775cde27..eabdb9fc92 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -111,6 +111,7 @@ public: void uniform3fv(U32 index, U32 count, const GLfloat* v); void uniform4fv(U32 index, U32 count, const GLfloat* v); void uniform1i(const std::string& uniform, GLint i); + void uniform2i(const std::string& uniform, GLint i, GLint j); void uniform1f(const std::string& uniform, GLfloat v); void uniform2f(const std::string& uniform, GLfloat x, GLfloat y); void uniform3f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z); @@ -170,6 +171,7 @@ public: U32 mAttributeMask; //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask()) std::vector mUniform; //lookup table of uniform enum to uniform location std::map mUniformMap; //lookup map of uniform name to uniform location + std::map mUniformNameMap; //lookup map of uniform location to uniform name std::map mValue; //lookup map of uniform location to last known value std::vector mTexture; S32 mTotalUniformSize; @@ -192,6 +194,11 @@ public: static U64 sTotalSamplesDrawn; U32 mDrawCalls; static U32 sTotalDrawCalls; + + bool mTextureStateFetched; + std::vector mTextureMagFilter; + std::vector mTextureMinFilter; + }; //UI shader (declared here so llui_libtest will link properly) -- cgit v1.2.3