diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 14 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/cofF.glsl | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl | 19 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl | 1 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llselectmgr.h | 2 | ||||
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 4 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 11 | ||||
-rwxr-xr-x | indra/newview/llvovolume.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 8 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 1 |
13 files changed, 57 insertions, 19 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d07efa6a37..aa08b0783e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8017,7 +8017,19 @@ <key>Value</key> <integer>0</integer> </map> - + + <key>CameraDoFResScale</key> + <map> + <key>Comment</key> + <string>Amount to scale down depth of field resolution. Valid range is 0.25 (quarter res) to 1.0 (full res)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.7</real> + </map> + <key>RenderSpotLightsInNondeferred</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 56fa4e693b..88fe3c3dee 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -83,5 +83,5 @@ void main() vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); gl_FragColor.rgb = diff.rgb + bloom.rgb; - gl_FragColor.a = sc/10.f; + gl_FragColor.a = sc/max_cof; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index d2903b545c..21453aefaa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -36,6 +36,7 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform float max_cof; +uniform float res_scale; VARYING vec2 vary_fragcoord; @@ -43,10 +44,24 @@ void main() { vec2 tc = vary_fragcoord.xy; - vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*0.5); + vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale); vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy); - float a = min(diff.a * max_cof*0.333, 1.0); + float a = min(diff.a * max_cof*res_scale*res_scale, 1.0); + + if (a > 0.25 && a < 0.75) + { //help out the transition a bit + float sc = a/res_scale; + + vec4 col; + col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc)); + col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc)); + col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc)); + col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)); + + diff = mix(diff, col*0.25, a); + } + gl_FragColor = mix(diff, dof, a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 629648ddc3..4603d99c5e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -34,6 +34,7 @@ uniform sampler2DRect diffuseRect; uniform mat4 inv_proj; uniform vec2 screen_res; uniform float max_cof; +uniform float res_scale; VARYING vec2 vary_fragcoord; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 2971ee710a..830a7778ac 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6524,7 +6524,7 @@ F32 LLObjectSelection::getSelectedObjectStreamingCost(S32* total_bytes, S32* vis return cost; } -U32 LLObjectSelection::getSelectedObjectTriangleCount() +U32 LLObjectSelection::getSelectedObjectTriangleCount(S32* vcount) { U32 count = 0; for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter) @@ -6534,7 +6534,7 @@ U32 LLObjectSelection::getSelectedObjectTriangleCount() if (object) { - count += object->getTriangleCount(); + count += object->getTriangleCount(vcount); } } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 166616e13e..87ada5ac6b 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -286,7 +286,7 @@ public: S32 getSelectedObjectRenderCost(); F32 getSelectedObjectStreamingCost(S32* total_bytes = NULL, S32* visible_bytes = NULL); - U32 getSelectedObjectTriangleCount(); + U32 getSelectedObjectTriangleCount(S32* vcount = NULL); S32 getTECount(); S32 getRootObjectCount(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index d81e67bfe2..b8772971aa 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3219,12 +3219,12 @@ F32 LLViewerObject::getLinksetPhysicsCost() return mLinksetPhysicsCost; } -F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes) +F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const { return 0.f; } -U32 LLViewerObject::getTriangleCount() +U32 LLViewerObject::getTriangleCount(S32* vcount) const { return 0; } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index a77725c1ca..c8152e1539 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -340,8 +340,8 @@ public: virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE); - virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL); - virtual U32 getTriangleCount(); + virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const; + virtual U32 getTriangleCount(S32* vcount = NULL) const; virtual U32 getHighLODTriangleCount(); void setObjectCost(F32 cost); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 55834f5d99..8af83246da 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -489,6 +489,7 @@ public: { F32 cost = 0.f; S32 count = 0; + S32 vcount = 0; S32 object_count = 0; S32 total_bytes = 0; S32 visible_bytes = 0; @@ -510,7 +511,9 @@ public: S32 bytes = 0; S32 visible = 0; cost += object->getStreamingCost(&bytes, &visible); - count += object->getTriangleCount(); + S32 vt = 0; + count += object->getTriangleCount(&vt); + vcount += vt; total_bytes += bytes; visible_bytes += visible; } @@ -521,15 +524,15 @@ public: { label = "Selection"; cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectStreamingCost(&total_bytes, &visible_bytes); - count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount(); + count = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectTriangleCount(&vcount); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); } addText(xpos,ypos, llformat("%s streaming cost: %.1f", label, cost)); ypos += y_inc; - addText(xpos, ypos, llformat(" %.3f KTris, %.1f/%.1f KB, %d objects", - count/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count)); + addText(xpos, ypos, llformat(" %.3f KTris, %.3f KVerts, %.1f/%.1f KB, %d objects", + count/1000.f, vcount/1000.f, visible_bytes/1024.f, total_bytes/1024.f, object_count)); ypos += y_inc; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b75a0a799a..827c5b9cb5 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3266,13 +3266,13 @@ void LLVOVolume::updateRenderComplexity() mRenderComplexity_current = 0; } -U32 LLVOVolume::getTriangleCount() const +U32 LLVOVolume::getTriangleCount(S32* vcount) const { U32 count = 0; LLVolume* volume = getVolume(); if (volume) { - count = volume->getNumTriangles(); + count = volume->getNumTriangles(vcount); } return count; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index b6347526ee..64457975f8 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -133,7 +133,7 @@ public: U32 getRenderCost(texture_cost_t &textures) const; /*virtual*/ F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const; - /*virtual*/ U32 getTriangleCount() const; + /*virtual*/ U32 getTriangleCount(S32* vcount = NULL) const; /*virtual*/ U32 getHighLODTriangleCount(); /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3f91c3cddc..da4ffd97de 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -186,6 +186,7 @@ F32 LLPipeline::RenderShadowErrorCutoff; F32 LLPipeline::RenderShadowFOVCutoff; BOOL LLPipeline::CameraOffset; F32 LLPipeline::CameraMaxCoF; +F32 LLPipeline::CameraDoFResScale; const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f; @@ -929,6 +930,7 @@ void LLPipeline::refreshCachedSettings() RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff"); CameraOffset = gSavedSettings.getBOOL("CameraOffset"); CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF"); + CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale"); } void LLPipeline::releaseGLBuffers() @@ -6549,6 +6551,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f/LLDrawable::sCurPixelAngle)); shader->uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification); shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); + shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); @@ -6568,7 +6571,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { //perform DoF sampling at half-res (preserve alpha channel) mScreen.bindTarget(); - glViewport(0,0,mScreen.getWidth()/2, mScreen.getHeight()/2); + glViewport(0,0,mScreen.getWidth()*CameraDoFResScale, mScreen.getHeight()*CameraDoFResScale); gGL.setColorMask(true, false); shader = &gDeferredPostProgram; @@ -6580,6 +6583,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); + shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); @@ -6611,9 +6615,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (channel > -1) { mScreen.bindTexture(0, channel); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF); + shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale); gGL.begin(LLRender::TRIANGLE_STRIP); gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index e607e0aec6..8b6532ca25 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -846,6 +846,7 @@ public: static F32 RenderShadowFOVCutoff; static BOOL CameraOffset; static F32 CameraMaxCoF; + static F32 CameraDoFResScale; }; void render_bbox(const LLVector3 &min, const LLVector3 &max); |