diff options
Diffstat (limited to 'indra/llrender')
| -rw-r--r-- | indra/llrender/llglslshader.cpp | 4 | ||||
| -rw-r--r-- | indra/llrender/llglslshader.h | 2 | ||||
| -rw-r--r-- | indra/llrender/llgltexture.h | 2 | ||||
| -rw-r--r-- | indra/llrender/llrendernavprim.cpp | 10 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 75 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 33 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 4 | ||||
| -rw-r--r-- | indra/llrender/llvertexbuffer.h | 5 | 
8 files changed, 118 insertions, 17 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index ccfb8f69be..be5ad08fbe 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1184,12 +1184,14 @@ S32 LLGLSLShader::getTextureChannel(S32 uniform) const  S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode, LLTexUnit::eTextureColorSpace space)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - +          if (uniform < 0 || uniform >= (S32)mTexture.size())      {          LL_SHADER_UNIFORM_ERRS() << "Uniform out of range: " << uniform << LL_ENDL;          return -1;      } + +          S32 index = mTexture[uniform];      if (index != -1)      { diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 43d095f73a..e8529ebadc 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -56,6 +56,8 @@ public:      bool hasAlphaMask = false;      bool hasReflectionProbes = false;      bool attachNothing = false; +    bool hasHeroProbes = false; +    bool isPBRTerrain = false;  };  // ============= Structure for caching shader uniforms =============== diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 24849d1d1b..1cc8fbe523 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -42,7 +42,7 @@ class LLGLTexture : public LLTexture  public:  	enum  	{ -		MAX_IMAGE_SIZE_DEFAULT = 1024, +		MAX_IMAGE_SIZE_DEFAULT = 2048,  		INVALID_DISCARD_LEVEL = 0x7fff  	}; diff --git a/indra/llrender/llrendernavprim.cpp b/indra/llrender/llrendernavprim.cpp index d610a44bc6..eea3077632 100644 --- a/indra/llrender/llrendernavprim.cpp +++ b/indra/llrender/llrendernavprim.cpp @@ -40,20 +40,20 @@ LLRenderNavPrim gRenderNav;  //=============================================================================  void LLRenderNavPrim::renderLLTri( const LLVector3& a, const LLVector3& b, const LLVector3& c, const LLColor4U& color ) const  { -	LLColor4 cV(color); -	gGL.color4fv( cV.mV ); -	gGL.begin(LLRender::TRIANGLES); +    gGL.color4ubv(color.mV); + +    gGL.begin(LLRender::TRIANGLES);  	{  		gGL.vertex3fv( a.mV );  		gGL.vertex3fv( b.mV );  		gGL.vertex3fv( c.mV );  	} -	gGL.end();		 +	gGL.end();  }  //=============================================================================  void LLRenderNavPrim::renderNavMeshVB( U32 mode, LLVertexBuffer* pVBO, int vertCnt )  {	  	pVBO->setBuffer(); -	pVBO->drawArrays( mode, 0, vertCnt );	 +	pVBO->drawArrays( mode, 0, vertCnt );  }  //============================================================================= diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index f78be910d2..5384133220 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -44,6 +44,7 @@ using std::make_pair;  using std::string;  LLShaderMgr * LLShaderMgr::sInstance = NULL; +bool LLShaderMgr::sMirrorsEnabled = false;  LLShaderMgr::LLShaderMgr()  { @@ -183,7 +184,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)  	// Attach Fragment Shader Features Next  	/////////////////////////////////////// -// NOTE order of shader object attaching is VERY IMPORTANT!!! +    // NOTE order of shader object attaching is VERY IMPORTANT!!! +     +    if (!shader->attachFragmentObject("deferred/globalF.glsl")) +    { +        return FALSE; +    } +      if (features->hasSrgb || features->hasAtmospherics || features->calculatesAtmospherics || features->isDeferred)      {          if (!shader->attachFragmentObject("environment/srgbF.glsl")) @@ -277,6 +284,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)  		}  	} +    if (features->isPBRTerrain) +    { +        if (!shader->attachFragmentObject("deferred/pbrterrainUtilF.glsl")) +        { +            return FALSE; +        } +    } +	  	// NOTE order of shader object attaching is VERY IMPORTANT!!!  	if (features->hasAtmospherics)  	{ @@ -572,21 +587,38 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev          }  		else  		{ -			//set version to 1.40 -			shader_code_text[shader_code_count++] = strdup("#version 140\n"); -			//some implementations of GLSL 1.30 require integer precision be explicitly declared -			extra_code_text[extra_code_count++] = strdup("precision mediump int;\n"); -			extra_code_text[extra_code_count++] = strdup("precision highp float;\n"); +            if (type == GL_GEOMETRY_SHADER) +            { +                //set version to 1.50 +                shader_code_text[shader_code_count++] = strdup("#version 150\n"); +                //some implementations of GLSL 1.30 require integer precision be explicitly declared +                extra_code_text[extra_code_count++] = strdup("precision mediump int;\n"); +                extra_code_text[extra_code_count++] = strdup("precision highp float;\n"); +            } +            else +            { +                //set version to 1.40 +                shader_code_text[shader_code_count++] = strdup("#version 140\n"); +                //some implementations of GLSL 1.30 require integer precision be explicitly declared +                extra_code_text[extra_code_count++] = strdup("precision mediump int;\n"); +                extra_code_text[extra_code_count++] = strdup("precision highp float;\n"); +            }  		}  		extra_code_text[extra_code_count++] = strdup("#define FXAA_GLSL_130 1\n");  	} +    if (sMirrorsEnabled) +    { +        extra_code_text[extra_code_count++] = strdup("#define HERO_PROBES 1\n"); +    } +      // Use alpha float to store bit flags      // See: C++: addDeferredAttachment(), shader: frag_data[2]      extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_SKIP_ATMOS   0.0 \n"); // atmo kill      extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_ATMOS    0.34\n"); // bit 0      extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_PBR      0.67\n"); // bit 1 +    extra_code_text[extra_code_count++] = strdup("#define GBUFFER_FLAG_HAS_MIRROR      1.0\n");  // bit 2      extra_code_text[extra_code_count++] = strdup("#define GET_GBUFFER_FLAG(flag)    (abs(norm.w-flag)< 0.1)\n");  	if (defines) @@ -1192,6 +1224,9 @@ void LLShaderMgr::initAttribsAndUniforms()      mReservedUniforms.push_back("emissiveColor");      mReservedUniforms.push_back("metallicFactor");      mReservedUniforms.push_back("roughnessFactor"); +    mReservedUniforms.push_back("mirror_flag"); +    mReservedUniforms.push_back("clipPlane"); +    mReservedUniforms.push_back("clipSign");  	mReservedUniforms.push_back("diffuseMap");      mReservedUniforms.push_back("altDiffuseMap"); @@ -1204,6 +1239,7 @@ void LLShaderMgr::initAttribsAndUniforms()      mReservedUniforms.push_back("sceneDepth");      mReservedUniforms.push_back("reflectionProbes");      mReservedUniforms.push_back("irradianceProbes"); +    mReservedUniforms.push_back("heroProbes");  	mReservedUniforms.push_back("cloud_noise_texture");      mReservedUniforms.push_back("cloud_noise_texture_next");  	mReservedUniforms.push_back("fullbright"); @@ -1374,8 +1410,32 @@ void LLShaderMgr::initAttribsAndUniforms()  	mReservedUniforms.push_back("detail_1");  	mReservedUniforms.push_back("detail_2");  	mReservedUniforms.push_back("detail_3"); +  	mReservedUniforms.push_back("alpha_ramp"); +	mReservedUniforms.push_back("detail_0_base_color"); +	mReservedUniforms.push_back("detail_1_base_color"); +	mReservedUniforms.push_back("detail_2_base_color"); +	mReservedUniforms.push_back("detail_3_base_color"); +	mReservedUniforms.push_back("detail_0_normal"); +	mReservedUniforms.push_back("detail_1_normal"); +	mReservedUniforms.push_back("detail_2_normal"); +	mReservedUniforms.push_back("detail_3_normal"); +	mReservedUniforms.push_back("detail_0_metallic_roughness"); +	mReservedUniforms.push_back("detail_1_metallic_roughness"); +	mReservedUniforms.push_back("detail_2_metallic_roughness"); +	mReservedUniforms.push_back("detail_3_metallic_roughness"); +	mReservedUniforms.push_back("detail_0_emissive"); +	mReservedUniforms.push_back("detail_1_emissive"); +	mReservedUniforms.push_back("detail_2_emissive"); +	mReservedUniforms.push_back("detail_3_emissive"); + +    mReservedUniforms.push_back("baseColorFactors"); +    mReservedUniforms.push_back("metallicFactors"); +    mReservedUniforms.push_back("roughnessFactors"); +    mReservedUniforms.push_back("emissiveColors"); +    mReservedUniforms.push_back("minimum_alphas"); +  	mReservedUniforms.push_back("origin");  	mReservedUniforms.push_back("display_gamma"); @@ -1397,6 +1457,7 @@ void LLShaderMgr::initAttribsAndUniforms()      mReservedUniforms.push_back("cloud_variance");      mReservedUniforms.push_back("reflection_probe_ambiance");      mReservedUniforms.push_back("max_probe_lod"); +    mReservedUniforms.push_back("probe_strength");      mReservedUniforms.push_back("sh_input_r");      mReservedUniforms.push_back("sh_input_g"); @@ -1407,6 +1468,8 @@ void LLShaderMgr::initAttribsAndUniforms()      mReservedUniforms.push_back("sun_up_factor");      mReservedUniforms.push_back("moonlight_color"); +    mReservedUniforms.push_back("debug_normal_draw_length"); +  	llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);  	std::set<std::string> dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 79a24773e1..eb13418cd7 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -85,6 +85,9 @@ public:          EMISSIVE_COLOR,                     //  "emissiveColor"          METALLIC_FACTOR,                    //  "metallicFactor"          ROUGHNESS_FACTOR,                   //  "roughnessFactor" +        MIRROR_FLAG,                        //  "mirror_flag" +        CLIP_PLANE,                         //  "clipPlane" +        CLIP_SIGN,                          //  "clipSign"          DIFFUSE_MAP,                        //  "diffuseMap"          ALTERNATE_DIFFUSE_MAP,              //  "altDiffuseMap"          SPECULAR_MAP,                       //  "specularMap" @@ -96,6 +99,7 @@ public:          SCENE_DEPTH,                        //  "sceneDepth"          REFLECTION_PROBES,                  //  "reflectionProbes"          IRRADIANCE_PROBES,                  //  "irradianceProbes" +        HERO_PROBE,                         //  "heroProbes"          CLOUD_NOISE_MAP,                    //  "cloud_noise_texture"          CLOUD_NOISE_MAP_NEXT,               //  "cloud_noise_texture_next"          FULLBRIGHT,                         //  "fullbright" @@ -251,8 +255,32 @@ public:          TERRAIN_DETAIL1,                    //  "detail_1"          TERRAIN_DETAIL2,                    //  "detail_2"          TERRAIN_DETAIL3,                    //  "detail_3" +          TERRAIN_ALPHARAMP,                  //  "alpha_ramp" +        TERRAIN_DETAIL0_BASE_COLOR,                //  "detail_0_base_color" (GLTF) +        TERRAIN_DETAIL1_BASE_COLOR,                //  "detail_1_base_color" (GLTF) +        TERRAIN_DETAIL2_BASE_COLOR,                //  "detail_2_base_color" (GLTF) +        TERRAIN_DETAIL3_BASE_COLOR,                //  "detail_3_base_color" (GLTF) +        TERRAIN_DETAIL0_NORMAL,                    //  "detail_0_normal" (GLTF) +        TERRAIN_DETAIL1_NORMAL,                    //  "detail_1_normal" (GLTF) +        TERRAIN_DETAIL2_NORMAL,                    //  "detail_2_normal" (GLTF) +        TERRAIN_DETAIL3_NORMAL,                    //  "detail_3_normal" (GLTF) +        TERRAIN_DETAIL0_METALLIC_ROUGHNESS,        //  "detail_0_metallic_roughness" (GLTF) +        TERRAIN_DETAIL1_METALLIC_ROUGHNESS,        //  "detail_1_metallic_roughness" (GLTF) +        TERRAIN_DETAIL2_METALLIC_ROUGHNESS,        //  "detail_2_metallic_roughness" (GLTF) +        TERRAIN_DETAIL3_METALLIC_ROUGHNESS,        //  "detail_3_metallic_roughness" (GLTF) +        TERRAIN_DETAIL0_EMISSIVE,                  //  "detail_0_emissive" (GLTF) +        TERRAIN_DETAIL1_EMISSIVE,                  //  "detail_1_emissive" (GLTF) +        TERRAIN_DETAIL2_EMISSIVE,                  //  "detail_2_emissive" (GLTF) +        TERRAIN_DETAIL3_EMISSIVE,                  //  "detail_3_emissive" (GLTF) + +        TERRAIN_BASE_COLOR_FACTORS,                //  "baseColorFactors" (GLTF) +        TERRAIN_METALLIC_FACTORS,                  //  "metallicFactors" (GLTF) +        TERRAIN_ROUGHNESS_FACTORS,                 //  "roughnessFactors" (GLTF) +        TERRAIN_EMISSIVE_COLORS,                   //  "emissiveColors" (GLTF) +        TERRAIN_MINIMUM_ALPHAS,                    //  "minimum_alphas" (GLTF) +          SHINY_ORIGIN,                       //  "origin"          DISPLAY_GAMMA,                      //  "display_gamma" @@ -279,6 +307,7 @@ public:          REFLECTION_PROBE_AMBIANCE,          //  "reflection_probe_ambiance"          REFLECTION_PROBE_MAX_LOD,            //  "max_probe_lod" +        REFLECTION_PROBE_STRENGTH,            //  "probe_strength"          SH_INPUT_L1R,                       //  "sh_input_r"          SH_INPUT_L1G,                       //  "sh_input_g"          SH_INPUT_L1B,                       //  "sh_input_b" @@ -287,6 +316,9 @@ public:          WATER_EDGE_FACTOR,                  //  "water_edge"          SUN_UP_FACTOR,                      //  "sun_up_factor"          MOONLIGHT_COLOR,                    //  "moonlight_color" + +        DEBUG_NORMAL_DRAW_LENGTH,           //  "debug_normal_draw_length" +          END_RESERVED_UNIFORMS      } eGLSLReservedUniforms;      // clang-format on @@ -336,6 +368,7 @@ public:      bool mShaderCacheInitialized = false;      bool mShaderCacheEnabled = false;      std::string mShaderCacheDir; +    static bool sMirrorsEnabled;  protected: diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index de27636c33..4f5f30d7c2 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1319,6 +1319,10 @@ bool LLVertexBuffer::getNormalStrider(LLStrider<LLVector3>& strider, U32 index,  {  	return VertexBufferStrider<LLVector3,TYPE_NORMAL>::get(*this, strider, index, count);  } +bool LLVertexBuffer::getNormalStrider(LLStrider<LLVector4a>& strider, U32 index, S32 count) +{ +    return VertexBufferStrider<LLVector4a, TYPE_NORMAL>::get(*this, strider, index, count); +}  bool LLVertexBuffer::getTangentStrider(LLStrider<LLVector3>& strider, U32 index, S32 count)  {  	return VertexBufferStrider<LLVector3,TYPE_TANGENT>::get(*this, strider, index, count); diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index f2d146d4bb..cc59e322ed 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -180,6 +180,7 @@ public:  	bool getTexCoord1Strider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);  	bool getTexCoord2Strider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);  	bool getNormalStrider(LLStrider<LLVector3>& strider, U32 index=0, S32 count = -1); +	bool getNormalStrider(LLStrider<LLVector4a>& strider, U32 index = 0, S32 count = -1);  	bool getTangentStrider(LLStrider<LLVector3>& strider, U32 index=0, S32 count = -1);  	bool getTangentStrider(LLStrider<LLVector4a>& strider, U32 index=0, S32 count = -1);  	bool getColorStrider(LLStrider<LLColor4U>& strider, U32 index=0, S32 count = -1); @@ -187,10 +188,6 @@ public:  	bool getWeightStrider(LLStrider<F32>& strider, U32 index=0, S32 count = -1);  	bool getWeight4Strider(LLStrider<LLVector4>& strider, U32 index=0, S32 count = -1);  	bool getClothWeightStrider(LLStrider<LLVector4>& strider, U32 index=0, S32 count = -1); -    bool getBasecolorTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1); -    bool getNormalTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1); -    bool getMetallicRoughnessTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1); -    bool getEmissiveTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);      void setPositionData(const LLVector4a* data);      void setTexCoordData(const LLVector2* data);  | 
