summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-09-15 00:55:11 -0500
committerDave Parks <davep@lindenlab.com>2011-09-15 00:55:11 -0500
commitf72a24bf3a5bf7ecb826ef5e6d7f17dbb92d5db2 (patch)
treea4a070ba8b95645089dcd55a848baec41b625cbc /indra/newview
parent758b936deaa0e6ea397c49afa5024315415eeb93 (diff)
parent530981a2149a74e1dc003cea1bbc9dc392fcae60 (diff)
merge
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/logcontrol.xml2
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl63
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl35
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl131
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl30
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl44
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl59
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/giV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl155
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl250
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl126
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl2099
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl2086
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl (renamed from indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl)24
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl (renamed from indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl)76
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl342
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl252
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/starsV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl140
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl44
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/treeV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/debugF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/debugV.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl39
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/highlightV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl37
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl (renamed from indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl)12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/uiV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/bumpV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl51
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl49
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/impostorV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewV.glsl53
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/shinyV.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl53
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleV.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/treeV.glsl56
-rw-r--r--indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl22
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl121
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl36
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl38
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/blurV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/environment/terrainV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/shinyV.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl57
-rw-r--r--indra/newview/app_settings/shaders/class2/objects/simpleV.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/giV.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl1
-rwxr-xr-xindra/newview/llagent.cpp8
-rw-r--r--indra/newview/llcylinder.cpp260
-rw-r--r--indra/newview/llcylinder.h33
-rw-r--r--indra/newview/lldrawpool.cpp16
-rw-r--r--indra/newview/lldrawpoolalpha.cpp33
-rw-r--r--indra/newview/lldrawpoolalpha.h1
-rw-r--r--indra/newview/lldrawpoolavatar.cpp168
-rw-r--r--indra/newview/lldrawpoolavatar.h2
-rw-r--r--indra/newview/lldrawpoolbump.cpp18
-rw-r--r--indra/newview/lldrawpoolground.cpp6
-rw-r--r--indra/newview/lldrawpoolsimple.cpp43
-rw-r--r--indra/newview/lldrawpoolsimple.h5
-rw-r--r--indra/newview/lldrawpoolsky.cpp12
-rw-r--r--indra/newview/lldrawpoolterrain.cpp139
-rw-r--r--indra/newview/lldrawpooltree.cpp22
-rw-r--r--indra/newview/lldrawpoolwater.cpp20
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp36
-rw-r--r--indra/newview/lldynamictexture.cpp9
-rw-r--r--indra/newview/llface.cpp75
-rw-r--r--indra/newview/llface.h6
-rw-r--r--indra/newview/llfasttimerview.cpp10
-rw-r--r--indra/newview/llfloateranimpreview.cpp19
-rw-r--r--indra/newview/llfloaterimagepreview.cpp69
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp56
-rw-r--r--indra/newview/llfloaterpostcard.cpp14
-rw-r--r--indra/newview/llfloatersnapshot.cpp16
-rw-r--r--indra/newview/llglsandbox.cpp6
-rw-r--r--indra/newview/llhudeffectbeam.cpp12
-rw-r--r--indra/newview/llhudeffectlookat.cpp4
-rw-r--r--indra/newview/llhudeffectpointat.cpp2
-rw-r--r--indra/newview/llhudrender.cpp14
-rw-r--r--indra/newview/llmanip.cpp28
-rw-r--r--indra/newview/llmaniprotate.cpp82
-rw-r--r--indra/newview/llmanipscale.cpp42
-rw-r--r--indra/newview/llmaniptranslate.cpp43
-rw-r--r--indra/newview/llnetmap.cpp10
-rw-r--r--indra/newview/llpanellogin.cpp8
-rw-r--r--indra/newview/llpreviewtexture.cpp2
-rw-r--r--indra/newview/llprogressview.cpp12
-rw-r--r--indra/newview/llselectmgr.cpp91
-rw-r--r--indra/newview/llspatialpartition.cpp154
-rw-r--r--indra/newview/llspatialpartition.h1
-rw-r--r--indra/newview/lltexlayer.cpp21
-rw-r--r--indra/newview/lltextureview.cpp4
-rw-r--r--indra/newview/lltoolbrush.cpp8
-rw-r--r--indra/newview/lltoolmorph.cpp19
-rw-r--r--indra/newview/lltracker.cpp12
-rw-r--r--indra/newview/llviewercamera.cpp18
-rw-r--r--indra/newview/llviewerdisplay.cpp80
-rw-r--r--indra/newview/llviewerjoint.cpp16
-rw-r--r--indra/newview/llviewerjointmesh.cpp38
-rw-r--r--indra/newview/llviewerparceloverlay.cpp10
-rw-r--r--indra/newview/llviewershadermgr.cpp604
-rw-r--r--indra/newview/llviewershadermgr.h48
-rw-r--r--indra/newview/llviewerwindow.cpp76
-rw-r--r--indra/newview/llvosurfacepatch.cpp20
-rw-r--r--indra/newview/llvotree.cpp23
-rwxr-xr-xindra/newview/llvovolume.cpp24
-rw-r--r--indra/newview/llvowlsky.cpp1
-rw-r--r--indra/newview/llwlparamset.cpp8
-rw-r--r--indra/newview/llworldmapview.cpp4
-rw-r--r--indra/newview/pipeline.cpp586
-rw-r--r--indra/newview/pipeline.h5
-rw-r--r--indra/newview/skins/default/xui/en/floater_about.xml52
197 files changed, 7966 insertions, 3582 deletions
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index ae72dee900..a76eb3cd37 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -43,7 +43,7 @@
<key>tags</key>
<array>
<!-- sample entry for debugging a specific item -->
-<!-- <string>Voice</string> -->
+<!-- <string>Voice</string> -->
</array>
</map>
</array>
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index c72da8d758..dca96910f2 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -24,8 +24,7 @@
*/
-
-attribute vec4 weight; //1
+attribute vec4 weight;
uniform vec4 matrixPalette[45];
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index c2fe60ddaf..c98b99b15a 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -22,8 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -31,31 +35,31 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
+
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- gl_Position = gl_ProjectionMatrix * pos;
-
- //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = projection_matrix * pos;
gl_FogFragCoord = length(pos.xyz);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0));
gl_FrontColor = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 1a0866be0a..9a19fb928b 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -31,16 +39,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
gl_FrontColor = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 09688b2be2..6fef303723 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -24,7 +24,7 @@
-attribute vec4 object_weight;
+attribute vec4 weight4;
uniform mat4 matrixPalette[32];
@@ -32,8 +32,8 @@ mat4 getObjectSkinnedTransform()
{
int i;
- vec4 w = fract(object_weight);
- vec4 index = floor(object_weight);
+ vec4 w = fract(weight4);
+ vec4 index = floor(weight4);
float scale = 1.0/(w.x+w.y+w.z+w.w);
w *= scale;
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index e25d84a594..21a9e91bf5 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -22,22 +22,26 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
mat4 getSkinnedTransform();
void main()
{
vec4 pos;
-
+ vec4 pos_in = vec4(position, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- gl_FrontColor = gl_Color;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_FrontColor = diffuse_color;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000..5d1306bfc9
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,63 @@
+/**
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+varying vec3 vary_ambient;
+varying vec3 vary_directional;
+varying vec3 vary_fragcoord;
+varying vec3 vary_position;
+varying vec3 vary_pointlight_col;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+ float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ vec2 sc = pos_screen.xy*2.0;
+ sc /= screen_res;
+ sc -= vec2(1.0,1.0);
+ vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+ vec4 pos = inv_proj * ndc;
+ pos /= pos.w;
+ pos.w = 1.0;
+ return pos;
+}
+
+void main()
+{
+ vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+ frag *= screen_res;
+
+ vec4 pos = vec4(vary_position, 1.0);
+
+ vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
+
+ vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0);
+ vec4 color = diff * col;
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index d57b8f8525..9deb9a701e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -21,8 +21,14 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getObjectSkinnedTransform();
@@ -76,20 +82,20 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getObjectSkinnedTransform();
- trans = gl_ModelViewMatrix * trans;
+ trans = modelview_matrix * trans;
- pos = trans * gl_Vertex;
+ pos = trans * vec4(position.xyz, 1.0);
- norm = gl_Vertex.xyz + gl_Normal.xyz;
- norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
+ norm = position.xyz + normal.xyz;
+ norm = normalize(( trans*vec4(norojrm, 1.0) ).xyz-pos.xyz);
- vec4 frag_pos = gl_ProjectionMatrix * pos;
+ vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
vary_position = pos.xyz;
@@ -97,7 +103,7 @@ void main()
calcAtmospherics(pos.xyz);
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -107,17 +113,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index f6a280462e..51e7c0780d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -23,7 +23,15 @@
* $/LicenseInfo$
*/
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -80,22 +88,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix * vert;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -105,7 +113,7 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
@@ -114,16 +122,16 @@ void main()
vary_light = gl_LightSource[0].position.xyz;
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = col.rgb*gl_Color.rgb;
+ col.rgb = col.rgb*diffuse_color.rgb;
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos = gl_ModelViewProjectionMatrix * vert;
+ pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index bf4e79d815..fc055e555d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -22,23 +22,29 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 modelview_matrix;
+uniform mat4 texture_matrix0;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
- vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
+ vec4 p = projection_matrix * vec4(pos, 1.0);
p.z = max(p.z, -p.w+0.01);
gl_Position = p;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
index f70ea4da52..df4de4f432 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
@@ -22,8 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -77,32 +81,31 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- vec4 frag_pos = gl_ProjectionMatrix * pos;
+ vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
vary_position = pos.xyz;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -112,17 +115,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb;
+ vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index d0f3397932..d5c20a22d9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -22,18 +22,25 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(normal_matrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index 3f30402583..a006b81ef7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -31,7 +31,7 @@ varying vec3 vary_normal;
void main()
{
- vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+ vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy);
if (diff.a < 0.2)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index c9a349f026..ba3cc82b39 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -31,7 +31,6 @@ varying vec4 post_pos;
void main()
{
- //gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
gl_FragColor = vec4(1,1,1,1);
gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index 3d2ad397df..6835b9c021 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -23,38 +23,39 @@
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
mat4 getSkinnedTransform();
-attribute vec4 weight;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec4 post_pos;
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- pos = gl_ProjectionMatrix * pos;
+ pos = projection_matrix * pos;
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
-
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 37fcef81f3..704845d310 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -23,7 +23,11 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
mat4 getSkinnedTransform();
@@ -33,28 +37,26 @@ varying vec3 vary_normal;
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
+ vec4 pos_in = vec4(position.xyz, 1.0);
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
vary_normal = norm;
- gl_Position = gl_ProjectionMatrix * pos;
- //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-
- gl_FrontColor = gl_Color;
+ gl_Position = projection_matrix * pos;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
deleted file mode 100644
index c858eb7a3a..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * @file blurLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2DRect lightMap;
-
-uniform float dist_factor;
-uniform float blur_size;
-uniform vec2 delta;
-uniform vec3 kern[4];
-uniform float kern_scale;
-
-varying vec2 vary_fragcoord;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-vec3 texture2DMS3(sampler2DMS tex, ivec2 tc)
-{
- vec3 ret = vec3(0,0,0);
- for (int i = 0; i < samples; i++)
- {
- ret += texelFetch(tex, tc, i).rgb;
- }
-
- return ret/samples;
-}
-
-float texture2DMS1(sampler2DMS tex, ivec2 tc)
-{
- float ret = 0;
- for (int i = 0; i < samples; i++)
- {
- ret += texelFetch(tex, tc, i).r;
- }
-
- return ret/samples;
-}
-
-vec4 getPosition(ivec2 pos_screen)
-{
- float depth = texture2DMS1(depthMap, pos_screen.xy);
- vec2 sc = pos_screen.xy*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-void main()
-{
- vec2 tc = vary_fragcoord.xy;
- ivec2 itc = ivec2(tc);
-
- vec3 norm = texture2DMS3(normalMap, itc).xyz;
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- vec3 pos = getPosition(itc).xyz;
- vec4 ccol = texture2DRect(lightMap, tc).rgba;
-
- vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
- dlt /= max(-pos.z*dist_factor, 1.0);
-
- vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
- vec4 col = defined_weight.xyxx * ccol;
-
- // relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances
- float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005;
-
- // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
- tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 );
-
- for (int i = 1; i < 4; i++)
- {
- vec2 samptc = tc + kern[i].z*dlt;
- vec3 samppos = getPosition(ivec2(samptc)).xyz;
- float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
- if (d*d <= pointplanedist_tolerance_pow2)
- {
- col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
- defined_weight += kern[i].xy;
- }
- }
- for (int i = 1; i < 4; i++)
- {
- vec2 samptc = vec2(tc - kern[i].z*dlt);
- vec3 samppos = getPosition(ivec2(samptc)).xyz;
- float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
- if (d*d <= pointplanedist_tolerance_pow2)
- {
- col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
- defined_weight += kern[i].xy;
- }
- }
-
- col /= defined_weight.xyxx;
- col.y *= col.y;
-
- gl_FragColor = col;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index e904b7ded0..5339e38018 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -22,8 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
index 7d934e7ff8..cf93430217 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
@@ -22,7 +22,15 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec2 texcoord2;
varying vec3 vary_mat0;
varying vec3 vary_mat1;
@@ -32,23 +40,23 @@ mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
- vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
+ vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
+ vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);
vary_mat1 = vec3(t.y, b.y, n.y);
vary_mat2 = vec3(t.z, b.z, n.z);
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
- gl_FrontColor = gl_Color;
+ gl_Position = projection_matrix*vec4(pos, 1.0);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 92fd41554d..9ec31383ac 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec3 binormal;
varying vec3 vary_mat0;
varying vec3 vary_mat1;
@@ -32,16 +40,16 @@ varying vec3 vary_mat2;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec3 n = normalize(gl_NormalMatrix * gl_Normal);
- vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);
+ vec3 n = normalize(normal_matrix * normal);
+ vec3 b = normalize(normal_matrix * binormal);
vec3 t = cross(b, n);
vary_mat0 = vec3(t.x, b.x, n.x);
vary_mat1 = vec3(t.y, b.y, n.y);
vary_mat2 = vec3(t.z, b.z, n.z);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index c175a834c2..67b5e7fb83 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -59,12 +62,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -160,7 +163,7 @@ void main()
// Texture coords
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_TexCoord[0].xy -= 0.5;
gl_TexCoord[0].xy /= cloud_scale.x;
gl_TexCoord[0].xy += 0.5;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index 933e50fed1..e1dc1de0af 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -1,5 +1,5 @@
/**
- * @file diffuseF.glsl
+ * @file diffuseAlphaMaskF.glsl
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -33,7 +33,7 @@ varying vec3 vary_normal;
void main()
{
- vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+ vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
if (col.a < minimum_alpha || col.a > maximum_alpha)
{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
new file mode 100644
index 0000000000..dfc1b52c2e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -0,0 +1,30 @@
+/**
+ * @file diffuseAlphaMaskNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec3 vary_normal;
+
+void main()
+{
+ vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(col.rgb, 0.0);
+ gl_FragData[1] = vec4(0,0,0,0); // spec
+ vec3 nvn = normalize(vary_normal);
+ gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
new file mode 100644
index 0000000000..37864578ec
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -0,0 +1,44 @@
+/**
+ * @file diffuseNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
+varying vec3 vary_normal;
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vary_normal = normalize(normal_matrix * normal);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index 1470d7c9ca..880a7ea0a2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -22,7 +22,14 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
@@ -30,21 +37,21 @@ mat4 getObjectSkinnedTransform();
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vary_normal = norm.xyz;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index 7c5a4d35b3..e158df13f7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -22,8 +22,15 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
varying float vary_texture_index;
@@ -31,11 +38,11 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_texture_index = gl_Vertex.w;
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_texture_index = position.w;
+ vary_normal = normalize(normal_matrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
new file mode 100644
index 0000000000..5a9a6196f3
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -0,0 +1,28 @@
+/**
+ * @file emissiveF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+
+void main()
+{
+ float shadow = 1.0;
+
+ vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;
+
+ color.rgb = fullbrightAtmosTransport(color.rgb);
+
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
new file mode 100644
index 0000000000..fccf8554d2
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -0,0 +1,59 @@
+/**
+ * @file emissiveV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+vec3 atmosAmbient(vec3 light);
+vec3 atmosAffectDirectionalLight(float lightIntensity);
+vec3 scaleDownLight(vec3 light);
+vec3 scaleUpLight(vec3 light);
+
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz, 1.0);
+ vec4 pos = (modelview_matrix * vert);
+ vary_texture_index = position.w;
+
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index a4ff0b80e2..2759165471 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -22,8 +22,15 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+
+attribute vec4 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -37,18 +44,17 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vec4 pos = (modelview_matrix * vert);
+ vary_texture_index = position.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
index 190e32b6a3..2766691bd0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec2 vary_fragcoord;
@@ -32,11 +37,12 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
+ vec4 tex = vec4(texcoord0,0,1);
tex.w = 1.0;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 0cf8c68173..645b0d793a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -22,14 +22,19 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
index 9f22175f84..dafc55a6ff 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
@@ -23,8 +23,10 @@
* $/LicenseInfo$
*/
-
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
varying vec2 vary_fragcoord;
@@ -33,9 +35,10 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
deleted file mode 100644
index 863bac19cf..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * @file multiPointLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-
-
-uniform vec3 env_mat[3];
-uniform float sun_wash;
-
-uniform int light_count;
-
-#define MAX_LIGHT_COUNT 16
-uniform vec4 light[MAX_LIGHT_COUNT];
-uniform vec4 light_col[MAX_LIGHT_COUNT];
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform float far_z;
-
-uniform mat4 inv_proj;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
- float depth = texelFetch(depthMap, pos_screen, sample).r;
- vec2 sc = vec2(pos_screen.xy)*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-void main()
-{
- vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
- ivec2 itc = ivec2(frag);
-
- int wght = 0;
- vec3 fcol = vec3(0,0,0);
-
- for (int s = 0; s < samples; ++s)
- {
- vec3 pos = getPosition(itc, s).xyz;
- if (pos.z >= far_z)
- {
- vec3 norm = texelFetch(normalMap, itc, s).xyz;
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- norm = normalize(norm);
- vec4 spec = texelFetch(specularRect, itc, s);
- vec3 diff = texelFetch(diffuseRect, itc, s).rgb;
- float noise = texture2D(noiseMap, frag.xy/128.0).b;
- vec3 out_col = vec3(0,0,0);
- vec3 npos = normalize(-pos);
-
- // As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
- for (int i = 0; i < MAX_LIGHT_COUNT; ++i)
- {
- bool light_contrib = (i < light_count);
-
- vec3 lv = light[i].xyz-pos;
- float dist2 = dot(lv,lv);
- dist2 /= light[i].w;
- if (dist2 > 1.0)
- {
- light_contrib = false;
- }
-
- float da = dot(norm, lv);
- if (da < 0.0)
- {
- light_contrib = false;
- }
-
- if (light_contrib)
- {
- lv = normalize(lv);
- da = dot(norm, lv);
-
- float fa = light_col[i].a+1.0;
- float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
- dist_atten *= noise;
-
- float lit = da * dist_atten;
-
- vec3 col = light_col[i].rgb*lit*diff;
- //vec3 col = vec3(dist2, light_col[i].a, lit);
-
- if (spec.a > 0.0)
- {
- //vec3 ref = dot(pos+lv, norm);
-
- float sa = dot(normalize(lv+npos),norm);
-
- if (sa > 0.0)
- {
- sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
- sa *= noise;
- col += da*sa*light_col[i].rgb*spec.rgb;
- }
- }
-
- out_col += col;
- }
- }
-
- fcol += out_col;
- ++wght;
- }
- }
-
- if (wght <= 0)
- {
- discard;
- }
-
- gl_FragColor.rgb = fcol/samples;
- gl_FragColor.a = 0.0;
-
-
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
index 1362a48daf..1d54d7bede 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
@@ -23,16 +23,17 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
gl_Position = pos;
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 85b0ce5beb..c42935d815 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -55,7 +55,10 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -110,7 +113,7 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
vec4 getPosition(vec2 pos_screen)
{
- float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ float depth = texture2DRect(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
@@ -129,9 +132,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -145,16 +148,16 @@ void main()
vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
if (proj_tc.z < 0.0)
{
- discard;
+ //discard;
}
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
if (dist_atten <= 0.0)
{
- discard;
+ //discard;
}
lv = proj_origin-pos.xyz;
@@ -182,7 +185,7 @@ void main()
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -199,7 +202,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -232,7 +235,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
deleted file mode 100644
index 10285817c2..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-//class 1 -- no shadows
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod; //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = tc-vec2(0.5);
-
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-
- return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-
- float det = min(lod/(proj_lod*0.5), 1.0);
-
- float d = min(dist.x, dist.y);
-
- float edge = 0.25*det;
-
- ret *= clamp(d/edge, 0.0, 1.0);
-
- return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = tc-vec2(0.5);
-
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-
- return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
- float depth = texelFetch(depthMap, pos_screen, sample).r;
- vec2 sc = vec2(pos_screen.xy)*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-void main()
-{
- int wght = 0;
-
- vec3 fcol = vec3(0,0,0);
-
- vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
-
- ivec2 itc = ivec2(frag.xy);
-
- for (int i = 0; i < samples; ++i)
- {
- vec3 pos = getPosition(itc, i).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
- if (dist2 <= 1.0)
- {
- vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0;
-
- norm = normalize(norm);
- float l_dist = -dot(lv, proj_n);
-
- vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
- if (proj_tc.z >= 0.0)
- {
- proj_tc.xyz /= proj_tc.w;
-
- float fa = gl_Color.a+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- if (dist_atten > 0.0)
- {
- lv = proj_origin-pos.xyz;
- lv = normalize(lv);
- float da = dot(norm, lv);
-
- vec3 col = vec3(0,0,0);
-
- vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-
- float noise = texture2D(noiseMap, frag.xy/128.0).b;
- if (proj_tc.z > 0.0 &&
- proj_tc.x < 1.0 &&
- proj_tc.y < 1.0 &&
- proj_tc.x > 0.0 &&
- proj_tc.y > 0.0)
- {
- float lit = 0.0;
- float amb_da = proj_ambiance;
-
- if (da > 0.0)
- {
- float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
- float lod = diff * proj_lod;
-
- vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-
- lit = da * dist_atten * noise;
-
- col = lcol*lit*diff_tex;
- amb_da += (da*0.5)*proj_ambiance;
- }
-
- //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
- vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-
- amb_da += (da*da*0.5+0.5)*proj_ambiance;
-
- amb_da *= dist_atten * noise;
-
- amb_da = min(amb_da, 1.0-lit);
-
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
- }
-
-
- vec4 spec = texelFetch(specularRect, itc, i);
- if (spec.a > 0.0)
- {
- vec3 ref = reflect(normalize(pos), norm);
-
- //project from point pos in direction ref to plane proj_p, proj_n
- vec3 pdelta = proj_p-pos;
- float ds = dot(ref, proj_n);
-
- if (ds < 0.0)
- {
- vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
- vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
- if (stc.z > 0.0)
- {
- stc.xy /= stc.w;
-
- float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-
- if (stc.x < 1.0 &&
- stc.y < 1.0 &&
- stc.x > 0.0 &&
- stc.y > 0.0)
- {
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
- }
- }
- }
- }
-
- fcol += col;
- ++wght;
- }
- }
- }
- }
-
- if (wght <= 0)
- {
- discard;
- }
-
- gl_FragColor.rgb = fcol/samples;
- gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 0771f9b91a..8c34a554c2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -38,7 +38,10 @@ uniform sampler2DRect depthMap;
uniform vec3 env_mat[3];
uniform float sun_wash;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -67,9 +70,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos;
+ vec3 lv = center.xyz-pos;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -90,11 +93,11 @@ void main()
float noise = texture2D(noiseMap, frag.xy/128.0).b;
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
float lit = da * dist_atten * noise;
- col = gl_Color.rgb*lit*col;
+ col = color.rgb*lit*col;
vec4 spec = texture2DRect(specularRect, frag.xy);
if (spec.a > 0.0)
@@ -104,7 +107,7 @@ void main()
{
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
sa *= noise;
- col += da*sa*gl_Color.rgb*spec.rgb;
+ col += da*sa*color.rgb*spec.rgb;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
deleted file mode 100644
index cdce58c84e..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * @file pointLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-
-
-uniform vec3 env_mat[3];
-uniform float sun_wash;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-uniform vec4 viewport;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
- float depth = texelFetch(depthMap, pos_screen, sample).r;
- vec2 sc = (vec2(pos_screen.xy)-viewport.xy)*2.0;
- sc /= viewport.zw;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-void main()
-{
- vec4 frag = vary_fragcoord;
- frag.xyz /= frag.w;
- frag.xyz = frag.xyz*0.5+0.5;
- frag.xy *= screen_res;
-
- ivec2 itc = ivec2(frag.xy);
-
- int wght = 0;
- vec3 fcol = vec3(0,0,0);
-
- for (int s = 0; s < samples; ++s)
- {
- vec3 pos = getPosition(itc, s).xyz;
- vec3 lv = vary_light.xyz-pos;
- float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
- if (dist2 <= 1.0)
- {
- vec3 norm = texelFetch(normalMap, itc, s).xyz;
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- float da = dot(norm, lv);
- if (da >= 0.0)
- {
- norm = normalize(norm);
- lv = normalize(lv);
- da = dot(norm, lv);
-
- float noise = texture2D(noiseMap, frag.xy/128.0).b;
-
- vec3 col = texelFetch(diffuseRect, itc, s).rgb;
- float fa = gl_Color.a+1.0;
- float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
- float lit = da * dist_atten * noise;
-
- col = gl_Color.rgb*lit*col;
-
- vec4 spec = texelFetch(specularRect, itc, s);
- if (spec.a > 0.0)
- {
- float sa = dot(normalize(lv-normalize(pos)),norm);
- if (sa > 0.0)
- {
- sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
- sa *= noise;
- col += da*sa*gl_Color.rgb*spec.rgb;
- }
- }
-
- fcol += col;
- ++wght;
- }
- }
- }
-
- if (wght <= 0)
- {
- discard;
- }
-
- gl_FragColor.rgb = fcol/samples;
- gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index db1b9d3feb..cab9817583 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -23,23 +23,17 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
-varying vec4 vary_light;
varying vec4 vary_fragcoord;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_fragcoord = pos;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
-
gl_Position = pos;
-
- gl_FrontColor = gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index 29f5f899ba..daef6a938c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -22,16 +22,2070 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+#extension GL_ARB_texture_rectangle : enable
+
+#define FXAA_PC 1
+//#define FXAA_GLSL_130 1
+#define FXAA_QUALITY__PRESET 12
+
+/*============================================================================
+
+
+ NVIDIA FXAA 3.11 by TIMOTHY LOTTES
+
+
+------------------------------------------------------------------------------
+COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
+------------------------------------------------------------------------------
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA
+OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
+OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
+THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+------------------------------------------------------------------------------
+ INTEGRATION CHECKLIST
+------------------------------------------------------------------------------
+(1.)
+In the shader source, setup defines for the desired configuration.
+When providing multiple shaders (for different presets),
+simply setup the defines differently in multiple files.
+Example,
+
+ #define FXAA_PC 1
+ #define FXAA_HLSL_5 1
+ #define FXAA_QUALITY__PRESET 12
+
+Or,
+
+ #define FXAA_360 1
+
+Or,
+
+ #define FXAA_PS3 1
+
+Etc.
+
+(2.)
+Then include this file,
+
+ #include "Fxaa3_11.h"
+
+(3.)
+Then call the FXAA pixel shader from within your desired shader.
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+As for FXAA 3.11 all inputs for all shaders are the same
+to enable easy porting between platforms.
+
+ return FxaaPixelShader(...);
+
+(4.)
+Insure pass prior to FXAA outputs RGBL (see next section).
+Or use,
+
+ #define FXAA_GREEN_AS_LUMA 1
+
+(5.)
+Setup engine to provide the following constants
+which are used in the FxaaPixelShader() inputs,
+
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+
+(6.)
+Have FXAA vertex shader run as a full screen triangle,
+and output "pos" and "fxaaConsolePosPos"
+such that inputs in the pixel shader provide,
+
+ // {xy} = center of pixel
+ FxaaFloat2 pos,
+
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ FxaaFloat4 fxaaConsolePosPos,
+
+(7.)
+Insure the texture sampler(s) used by FXAA are set to bilinear filtering.
+
+
+------------------------------------------------------------------------------
+ INTEGRATION - RGBL AND COLORSPACE
+------------------------------------------------------------------------------
+FXAA3 requires RGBL as input unless the following is set,
+
+ #define FXAA_GREEN_AS_LUMA 1
+
+In which case the engine uses green in place of luma,
+and requires RGB input is in a non-linear colorspace.
+
+RGB should be LDR (low dynamic range).
+Specifically do FXAA after tonemapping.
+
+RGB data as returned by a texture fetch can be non-linear,
+or linear when FXAA_GREEN_AS_LUMA is not set.
+Note an "sRGB format" texture counts as linear,
+because the result of a texture fetch is linear data.
+Regular "RGBA8" textures in the sRGB colorspace are non-linear.
+
+If FXAA_GREEN_AS_LUMA is not set,
+luma must be stored in the alpha channel prior to running FXAA.
+This luma should be in a perceptual space (could be gamma 2.0).
+Example pass before FXAA where output is gamma 2.0 encoded,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma
+ return color;
+
+Another example where output is linear encoded,
+say for instance writing to an sRGB formated render target,
+where the render target does the conversion back to sRGB after blending,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma
+ return color;
+
+Getting luma correct is required for the algorithm to work correctly.
+
+
+------------------------------------------------------------------------------
+ BEING LINEARLY CORRECT?
+------------------------------------------------------------------------------
+Applying FXAA to a framebuffer with linear RGB color will look worse.
+This is very counter intuitive, but happends to be true in this case.
+The reason is because dithering artifacts will be more visiable
+in a linear colorspace.
+
+
+------------------------------------------------------------------------------
+ COMPLEX INTEGRATION
+------------------------------------------------------------------------------
+Q. What if the engine is blending into RGB before wanting to run FXAA?
+
+A. In the last opaque pass prior to FXAA,
+ have the pass write out luma into alpha.
+ Then blend into RGB only.
+ FXAA should be able to run ok
+ assuming the blending pass did not any add aliasing.
+ This should be the common case for particles and common blending passes.
+
+A. Or use FXAA_GREEN_AS_LUMA.
+
+============================================================================*/
+
+/*============================================================================
+
+ INTEGRATION KNOBS
+
+============================================================================*/
+//
+// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE).
+// FXAA_360_OPT is a prototype for the new optimized 360 version.
+//
+// 1 = Use API.
+// 0 = Don't use API.
+//
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PS3
+ #define FXAA_PS3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360
+ #define FXAA_360 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360_OPT
+ #define FXAA_360_OPT 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_PC
+ //
+ // FXAA Quality
+ // The high quality PC algorithm.
+ //
+ #define FXAA_PC 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PC_CONSOLE
+ //
+ // The console algorithm for PC is included
+ // for developers targeting really low spec machines.
+ // Likely better to just run FXAA_PC, and use a really low preset.
+ //
+ #define FXAA_PC_CONSOLE 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_120
+ #define FXAA_GLSL_120 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_130
+ #define FXAA_GLSL_130 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_3
+ #define FXAA_HLSL_3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_4
+ #define FXAA_HLSL_4 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_5
+ #define FXAA_HLSL_5 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_GREEN_AS_LUMA
+ //
+ // For those using non-linear color,
+ // and either not able to get luma in alpha, or not wanting to,
+ // this enables FXAA to run using green as a proxy for luma.
+ // So with this enabled, no need to pack luma in alpha.
+ //
+ // This will turn off AA on anything which lacks some amount of green.
+ // Pure red and blue or combination of only R and B, will get no AA.
+ //
+ // Might want to lower the settings for both,
+ // fxaaConsoleEdgeThresholdMin
+ // fxaaQualityEdgeThresholdMin
+ // In order to insure AA does not get turned off on colors
+ // which contain a minor amount of green.
+ //
+ // 1 = On.
+ // 0 = Off.
+ //
+ #define FXAA_GREEN_AS_LUMA 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_EARLY_EXIT
+ //
+ // Controls algorithm's early exit path.
+ // On PS3 turning this ON adds 2 cycles to the shader.
+ // On 360 turning this OFF adds 10ths of a millisecond to the shader.
+ // Turning this off on console will result in a more blurry image.
+ // So this defaults to on.
+ //
+ // 1 = On.
+ // 0 = Off.
+ //
+ #define FXAA_EARLY_EXIT 1
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_DISCARD
+ //
+ // Only valid for PC OpenGL currently.
+ // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
+ //
+ // 1 = Use discard on pixels which don't need AA.
+ // For APIs which enable concurrent TEX+ROP from same surface.
+ // 0 = Return unchanged color on pixels which don't need AA.
+ //
+ #define FXAA_DISCARD 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_FAST_PIXEL_OFFSET
+ //
+ // Used for GLSL 120 only.
+ //
+ // 1 = GL API supports fast pixel offsets
+ // 0 = do not use fast pixel offsets
+ //
+ #ifdef GL_EXT_gpu_shader4
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifndef FXAA_FAST_PIXEL_OFFSET
+ #define FXAA_FAST_PIXEL_OFFSET 0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GATHER4_ALPHA
+ //
+ // 1 = API supports gather4 on alpha channel.
+ // 0 = API does not support gather4 on alpha channel.
+ //
+ #if (FXAA_HLSL_5 == 1)
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifndef FXAA_GATHER4_ALPHA
+ #define FXAA_GATHER4_ALPHA 0
+ #endif
+#endif
+
+/*============================================================================
+ FXAA CONSOLE PS3 - TUNING KNOBS
+============================================================================*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS
+ //
+ // Consoles the sharpness of edges on PS3 only.
+ // Non-PS3 tuning is done with shader input.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 4 and 8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ //
+ // 8.0 is sharper
+ // 4.0 is softer
+ // 2.0 is really soft (good for vector graphics inputs)
+ //
+ #if 1
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0
+ #endif
+ #if 0
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0
+ #endif
+ #if 0
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD
+ //
+ // Only effects PS3.
+ // Non-PS3 tuning is done with shader input.
+ //
+ // The minimum amount of local contrast required to apply algorithm.
+ // The console setting has a different mapping than the quality setting.
+ //
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 0.25 and 0.125.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ //
+ // 0.125 leaves less aliasing, but is softer
+ // 0.25 leaves more aliasing, and is sharper
+ //
+ #if 1
+ #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125
+ #else
+ #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25
+ #endif
+#endif
+
+/*============================================================================
+ FXAA QUALITY - TUNING KNOBS
+------------------------------------------------------------------------------
+NOTE the other tuning knobs are now in the shader function inputs!
+============================================================================*/
+#ifndef FXAA_QUALITY__PRESET
+ //
+ // Choose the quality preset.
+ // This needs to be compiled into the shader as it effects code.
+ // Best option to include multiple presets is to
+ // in each shader define the preset, then include this file.
+ //
+ // OPTIONS
+ // -----------------------------------------------------------------------
+ // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
+ // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
+ // 39 - no dither, very expensive
+ //
+ // NOTES
+ // -----------------------------------------------------------------------
+ // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
+ // 13 = about same speed as FXAA 3.9 and better than 12
+ // 23 = closest to FXAA 3.9 visually and performance wise
+ // _ = the lowest digit is directly related to performance
+ // _ = the highest digit is directly related to style
+ //
+ #define FXAA_QUALITY__PRESET 12
+#endif
+
+
+/*============================================================================
+
+ FXAA QUALITY - PRESETS
+
+============================================================================*/
+
+/*============================================================================
+ FXAA QUALITY - MEDIUM DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 10)
+ #define FXAA_QUALITY__PS 3
+ #define FXAA_QUALITY__P0 1.5
+ #define FXAA_QUALITY__P1 3.0
+ #define FXAA_QUALITY__P2 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 11)
+ #define FXAA_QUALITY__PS 4
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 3.0
+ #define FXAA_QUALITY__P3 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 12)
+ #define FXAA_QUALITY__PS 5
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 4.0
+ #define FXAA_QUALITY__P4 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 13)
+ #define FXAA_QUALITY__PS 6
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 4.0
+ #define FXAA_QUALITY__P5 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 14)
+ #define FXAA_QUALITY__PS 7
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 4.0
+ #define FXAA_QUALITY__P6 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 15)
+ #define FXAA_QUALITY__PS 8
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 4.0
+ #define FXAA_QUALITY__P7 12.0
+#endif
+
+/*============================================================================
+ FXAA QUALITY - LOW DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 20)
+ #define FXAA_QUALITY__PS 3
+ #define FXAA_QUALITY__P0 1.5
+ #define FXAA_QUALITY__P1 2.0
+ #define FXAA_QUALITY__P2 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 21)
+ #define FXAA_QUALITY__PS 4
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 22)
+ #define FXAA_QUALITY__PS 5
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 23)
+ #define FXAA_QUALITY__PS 6
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 24)
+ #define FXAA_QUALITY__PS 7
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 3.0
+ #define FXAA_QUALITY__P6 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 25)
+ #define FXAA_QUALITY__PS 8
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 4.0
+ #define FXAA_QUALITY__P7 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 26)
+ #define FXAA_QUALITY__PS 9
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 4.0
+ #define FXAA_QUALITY__P8 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 27)
+ #define FXAA_QUALITY__PS 10
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 4.0
+ #define FXAA_QUALITY__P9 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 28)
+ #define FXAA_QUALITY__PS 11
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 4.0
+ #define FXAA_QUALITY__P10 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 29)
+ #define FXAA_QUALITY__PS 12
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 2.0
+ #define FXAA_QUALITY__P10 4.0
+ #define FXAA_QUALITY__P11 8.0
+#endif
+
+/*============================================================================
+ FXAA QUALITY - EXTREME QUALITY
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 39)
+ #define FXAA_QUALITY__PS 12
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.0
+ #define FXAA_QUALITY__P2 1.0
+ #define FXAA_QUALITY__P3 1.0
+ #define FXAA_QUALITY__P4 1.0
+ #define FXAA_QUALITY__P5 1.5
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 2.0
+ #define FXAA_QUALITY__P10 4.0
+ #define FXAA_QUALITY__P11 8.0
+#endif
+
+
+
+/*============================================================================
+
+ API PORTING
+
+============================================================================*/
+#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
+ #define FxaaBool bool
+ #define FxaaDiscard discard
+ #define FxaaFloat float
+ #define FxaaFloat2 vec2
+ #define FxaaFloat3 vec3
+ #define FxaaFloat4 vec4
+ #define FxaaHalf float
+ #define FxaaHalf2 vec2
+ #define FxaaHalf3 vec3
+ #define FxaaHalf4 vec4
+ #define FxaaInt2 ivec2
+ #define FxaaSat(x) clamp(x, 0.0, 1.0)
+ #define FxaaTex sampler2D
+#else
+ #define FxaaBool bool
+ #define FxaaDiscard clip(-1)
+ #define FxaaFloat float
+ #define FxaaFloat2 float2
+ #define FxaaFloat3 float3
+ #define FxaaFloat4 float4
+ #define FxaaHalf half
+ #define FxaaHalf2 half2
+ #define FxaaHalf3 half3
+ #define FxaaHalf4 half4
+ #define FxaaSat(x) saturate(x)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_120 == 1)
+ // Requires,
+ // #version 120
+ // And at least,
+ // #extension GL_EXT_gpu_shader4 : enable
+ // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
+ #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
+ #if (FXAA_FAST_PIXEL_OFFSET == 1)
+ #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
+ #else
+ #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
+ #endif
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+ #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+ #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_130 == 1)
+ // Requires "#version 130" or better
+ #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+ #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+ #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1)
+ #define FxaaInt2 float2
+ #define FxaaTex sampler2D
+ #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
+ #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_4 == 1)
+ #define FxaaInt2 int2
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_5 == 1)
+ #define FxaaInt2 int2
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+ #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
+ #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
+ #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
+ #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
+#endif
+
+
+/*============================================================================
+ GREEN AS LUMA OPTION SUPPORT FUNCTION
+============================================================================*/
+#if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
+#else
+ FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
+#endif
+
+
+
+
+/*============================================================================
+
+ FXAA3 QUALITY - PC
+
+============================================================================*/
+#if (FXAA_PC == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+ //
+ // Use noperspective interpolation here (turn off perspective interpolation).
+ // {xy} = center of pixel
+ FxaaFloat2 pos,
+ //
+ // Used only for FXAA Console, and not used on the 360 version.
+ // Use noperspective interpolation here (turn off perspective interpolation).
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ FxaaFloat4 fxaaConsolePosPos,
+ //
+ // Input color texture.
+ // {rgb_} = color in linear or perceptual color space
+ // if (FXAA_GREEN_AS_LUMA == 0)
+ // {___a} = luma in perceptual color space (not linear)
+ FxaaTex tex,
+ //
+ // Only used on the optimized 360 version of FXAA Console.
+ // For everything but 360, just use the same input here as for "tex".
+ // For 360, same texture, just alias with a 2nd sampler.
+ // This sampler needs to have an exponent bias of -1.
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ //
+ // Only used on the optimized 360 version of FXAA Console.
+ // For everything but 360, just use the same input here as for "tex".
+ // For 360, same texture, just alias with a 3nd sampler.
+ // This sampler needs to have an exponent bias of -2.
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ //
+ // Only used on FXAA Quality.
+ // This must be from a constant/uniform.
+ // {x_} = 1.0/screenWidthInPixels
+ // {_y} = 1.0/screenHeightInPixels
+ FxaaFloat2 fxaaQualityRcpFrame,
+ //
+ // Only used on FXAA Console.
+ // This must be from a constant/uniform.
+ // This effects sub-pixel AA quality and inversely sharpness.
+ // Where N ranges between,
+ // N = 0.50 (default)
+ // N = 0.33 (sharper)
+ // {x___} = -N/screenWidthInPixels
+ // {_y__} = -N/screenHeightInPixels
+ // {__z_} = N/screenWidthInPixels
+ // {___w} = N/screenHeightInPixels
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ //
+ // Only used on FXAA Console.
+ // Not used on 360, but used on PS3 and PC.
+ // This must be from a constant/uniform.
+ // {x___} = -2.0/screenWidthInPixels
+ // {_y__} = -2.0/screenHeightInPixels
+ // {__z_} = 2.0/screenWidthInPixels
+ // {___w} = 2.0/screenHeightInPixels
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ //
+ // Only used on FXAA Console.
+ // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
+ // This must be from a constant/uniform.
+ // {x___} = 8.0/screenWidthInPixels
+ // {_y__} = 8.0/screenHeightInPixels
+ // {__z_} = -4.0/screenWidthInPixels
+ // {___w} = -4.0/screenHeightInPixels
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__SUBPIX define.
+ // It is here now to allow easier tuning.
+ // Choose the amount of sub-pixel aliasing removal.
+ // This can effect sharpness.
+ // 1.00 - upper limit (softer)
+ // 0.75 - default amount of filtering
+ // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
+ // 0.25 - almost off
+ // 0.00 - completely off
+ FxaaFloat fxaaQualitySubpix,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.
+ // It is here now to allow easier tuning.
+ // The minimum amount of local contrast required to apply algorithm.
+ // 0.333 - too little (faster)
+ // 0.250 - low quality
+ // 0.166 - default
+ // 0.125 - high quality
+ // 0.063 - overkill (slower)
+ FxaaFloat fxaaQualityEdgeThreshold,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.
+ // It is here now to allow easier tuning.
+ // Trims the algorithm from processing darks.
+ // 0.0833 - upper limit (default, the start of visible unfiltered edges)
+ // 0.0625 - high quality (faster)
+ // 0.0312 - visible limit (slower)
+ // Special notes when using FXAA_GREEN_AS_LUMA,
+ // Likely want to set this to zero.
+ // As colors that are mostly not-green
+ // will appear very dark in the green channel!
+ // Tune by looking at mostly non-green content,
+ // then start at zero and increase until aliasing is a problem.
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
+ // It is here now to allow easier tuning.
+ // This does not effect PS3, as this needs to be compiled in.
+ // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
+ // Due to the PS3 being ALU bound,
+ // there are only three safe values here: 2 and 4 and 8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ // For all other platforms can be a non-power of two.
+ // 8.0 is sharper (default!!!)
+ // 4.0 is softer
+ // 2.0 is really soft (good only for vector graphics inputs)
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
+ // It is here now to allow easier tuning.
+ // This does not effect PS3, as this needs to be compiled in.
+ // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 1/4 and 1/8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ // The console setting has a different mapping than the quality setting.
+ // Other platforms can use other values.
+ // 0.125 leaves less aliasing, but is softer (default!!!)
+ // 0.25 leaves more aliasing, and is sharper
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.
+ // It is here now to allow easier tuning.
+ // Trims the algorithm from processing darks.
+ // The console setting has a different mapping than the quality setting.
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ // This does not apply to PS3,
+ // PS3 was simplified to avoid more shader instructions.
+ // 0.06 - faster but more aliasing in darks
+ // 0.05 - default
+ // 0.04 - slower and less aliasing in darks
+ // Special notes when using FXAA_GREEN_AS_LUMA,
+ // Likely want to set this to zero.
+ // As colors that are mostly not-green
+ // will appear very dark in the green channel!
+ // Tune by looking at mostly non-green content,
+ // then start at zero and increase until aliasing is a problem.
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ //
+ // Extra constants for 360 FXAA Console only.
+ // Use zeros or anything else for other platforms.
+ // These must be in physical constant registers and NOT immedates.
+ // Immedates will result in compiler un-optimizing.
+ // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posM;
+ posM.x = pos.x;
+ posM.y = pos.y;
+ #if (FXAA_GATHER4_ALPHA == 1)
+ #if (FXAA_DISCARD == 0)
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ #define lumaM rgbyM.w
+ #else
+ #define lumaM rgbyM.y
+ #endif
+ #endif
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
+ FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
+ #else
+ FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
+ FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
+ #endif
+ #if (FXAA_DISCARD == 1)
+ #define lumaM luma4A.w
+ #endif
+ #define lumaE luma4A.z
+ #define lumaS luma4A.x
+ #define lumaSE luma4A.y
+ #define lumaNW luma4B.w
+ #define lumaN luma4B.z
+ #define lumaW luma4B.x
+ #else
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ #define lumaM rgbyM.w
+ #else
+ #define lumaM rgbyM.y
+ #endif
+ FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat maxSM = max(lumaS, lumaM);
+ FxaaFloat minSM = min(lumaS, lumaM);
+ FxaaFloat maxESM = max(lumaE, maxSM);
+ FxaaFloat minESM = min(lumaE, minSM);
+ FxaaFloat maxWN = max(lumaN, lumaW);
+ FxaaFloat minWN = min(lumaN, lumaW);
+ FxaaFloat rangeMax = max(maxWN, maxESM);
+ FxaaFloat rangeMin = min(minWN, minESM);
+ FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
+ FxaaFloat range = rangeMax - rangeMin;
+ FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
+ FxaaBool earlyExit = range < rangeMaxClamped;
+/*--------------------------------------------------------------------------*/
+ if(earlyExit)
+ #if (FXAA_DISCARD == 1)
+ FxaaDiscard;
+ #else
+ return rgbyM;
+ #endif
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GATHER4_ALPHA == 0)
+ FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+ #else
+ FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNS = lumaN + lumaS;
+ FxaaFloat lumaWE = lumaW + lumaE;
+ FxaaFloat subpixRcpRange = 1.0/range;
+ FxaaFloat subpixNSWE = lumaNS + lumaWE;
+ FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
+ FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNESE = lumaNE + lumaSE;
+ FxaaFloat lumaNWNE = lumaNW + lumaNE;
+ FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
+ FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNWSW = lumaNW + lumaSW;
+ FxaaFloat lumaSWSE = lumaSW + lumaSE;
+ FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
+ FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
+ FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
+ FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
+ FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
+ FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
+ FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
+ FxaaBool horzSpan = edgeHorz >= edgeVert;
+ FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
+/*--------------------------------------------------------------------------*/
+ if(!horzSpan) lumaN = lumaW;
+ if(!horzSpan) lumaS = lumaE;
+ if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
+ FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat gradientN = lumaN - lumaM;
+ FxaaFloat gradientS = lumaS - lumaM;
+ FxaaFloat lumaNN = lumaN + lumaM;
+ FxaaFloat lumaSS = lumaS + lumaM;
+ FxaaBool pairN = abs(gradientN) >= abs(gradientS);
+ FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
+ if(pairN) lengthSign = -lengthSign;
+ FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posB;
+ posB.x = posM.x;
+ posB.y = posM.y;
+ FxaaFloat2 offNP;
+ offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
+ offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
+ if(!horzSpan) posB.x += lengthSign * 0.5;
+ if( horzSpan) posB.y += lengthSign * 0.5;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posN;
+ posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
+ posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
+ FxaaFloat2 posP;
+ posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
+ posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
+ FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
+ FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
+ FxaaFloat subpixE = subpixC * subpixC;
+ FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
+/*--------------------------------------------------------------------------*/
+ if(!pairN) lumaNN = lumaSS;
+ FxaaFloat gradientScaled = gradient * 1.0/4.0;
+ FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
+ FxaaFloat subpixF = subpixD * subpixE;
+ FxaaBool lumaMLTZero = lumaMM < 0.0;
+/*--------------------------------------------------------------------------*/
+ lumaEndN -= lumaNN * 0.5;
+ lumaEndP -= lumaNN * 0.5;
+ FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
+ FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
+ FxaaBool doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
+/*--------------------------------------------------------------------------*/
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 3)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 4)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 5)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 6)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 7)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 8)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 9)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 10)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 11)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 12)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+/*--------------------------------------------------------------------------*/
+ FxaaFloat dstN = posM.x - posN.x;
+ FxaaFloat dstP = posP.x - posM.x;
+ if(!horzSpan) dstN = posM.y - posN.y;
+ if(!horzSpan) dstP = posP.y - posM.y;
+/*--------------------------------------------------------------------------*/
+ FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
+ FxaaFloat spanLength = (dstP + dstN);
+ FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
+ FxaaFloat spanLengthRcp = 1.0/spanLength;
+/*--------------------------------------------------------------------------*/
+ FxaaBool directionN = dstN < dstP;
+ FxaaFloat dst = min(dstN, dstP);
+ FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
+ FxaaFloat subpixG = subpixF * subpixF;
+ FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
+ FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
+ FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
+ if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
+ if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
+ #if (FXAA_DISCARD == 1)
+ return FxaaTexTop(tex, posM);
+ #else
+ return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
+ #endif
+}
+/*==========================================================================*/
+#endif
+
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - PC VERSION
+
+------------------------------------------------------------------------------
+Instead of using this on PC, I'd suggest just using FXAA Quality with
+ #define FXAA_QUALITY__PRESET 10
+Or
+ #define FXAA_QUALITY__PRESET 20
+Either are higher qualilty and almost as fast as this on modern PC GPUs.
+============================================================================*/
+#if (FXAA_PC_CONSOLE == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy));
+ FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw));
+ FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy));
+ FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw));
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat lumaM = rgbyM.w;
+ #else
+ FxaaFloat lumaM = rgbyM.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw);
+ lumaNe += 1.0/384.0;
+ FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe);
+ FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);
+ FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMinM = min(lumaMin, lumaM);
+ FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
+ FxaaFloat lumaMaxM = max(lumaMax, lumaM);
+ FxaaFloat dirSwMinusNe = lumaSw - lumaNe;
+ FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM;
+ FxaaFloat dirSeMinusNw = lumaSe - lumaNw;
+ if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 dir;
+ dir.x = dirSwMinusNe + dirSeMinusNw;
+ dir.y = dirSwMinusNe - dirSeMinusNw;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 dir1 = normalize(dir.xy);
+ FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw);
+ FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;
+ FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw);
+ FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyA = rgbyN1 + rgbyP1;
+ FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax);
+ #else
+ FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax);
+ #endif
+ if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5;
+ return rgbyB; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - 360 PIXEL SHADER
+
+------------------------------------------------------------------------------
+This optimized version thanks to suggestions from Andy Luedke.
+Should be fully tex bound in all cases.
+As of the FXAA 3.11 release, I have still not tested this code,
+however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10.
+And note this is replacing the old unoptimized version.
+If it does not work, please let me know so I can fix it.
+============================================================================*/
+#if (FXAA_360 == 1)
+/*--------------------------------------------------------------------------*/
+[reduceTempRegUsage(4)]
+float4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ float4 lumaNwNeSwSe;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ asm {
+ tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false
+ };
+ #else
+ asm {
+ tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false
+ };
+ #endif
+/*--------------------------------------------------------------------------*/
+ lumaNwNeSwSe.y += 1.0/384.0;
+ float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+ float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+ float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y);
+ float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y);
+/*--------------------------------------------------------------------------*/
+ float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ float lumaMinM = min(lumaMin, rgbyM.w);
+ float lumaMaxM = max(lumaMax, rgbyM.w);
+ #else
+ float lumaMinM = min(lumaMin, rgbyM.y);
+ float lumaMaxM = max(lumaMax, rgbyM.y);
+ #endif
+ if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM;
+/*--------------------------------------------------------------------------*/
+ float2 dir;
+ dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx);
+ dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy);
+ dir = normalize(dir);
+/*--------------------------------------------------------------------------*/
+ float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw;
+/*--------------------------------------------------------------------------*/
+ float4 dir2;
+ float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness;
+ dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5);
+ dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw;
+/*--------------------------------------------------------------------------*/
+ float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0));
+ float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0));
+ float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0));
+ float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+ float4 rgbyA = rgbyN1 + rgbyP1;
+ float4 rgbyB = rgbyN2 + rgbyP2 * 0.5 + rgbyA;
+/*--------------------------------------------------------------------------*/
+ float4 rgbyR = ((rgbyB.w - lumaMax) > 0.0) ? rgbyA : rgbyB;
+ rgbyR = ((rgbyB.w - lumaMin) > 0.0) ? rgbyR : rgbyA;
+ return rgbyR; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT)
+
+==============================================================================
+The code below does not exactly match the assembly.
+I have a feeling that 12 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h0.w(TRUE), v5.xwxx, #0
+ 6: addh h0.z(TRUE), -h2, h0.w
+ 7: texpkb h1.w(TRUE), v5, #0
+ 9: addh h0.x(TRUE), h0.z, -h1.w
+ 10: addh h3.w(TRUE), h0.z, h1
+ 11: texpkb h2.w(TRUE), v5.zwzz, #0
+ 13: addh h0.z(TRUE), h3.w, -h2.w
+ 14: addh h0.x(TRUE), h2.w, h0
+ 15: nrmh h1.xz(TRUE), h0_n
+ 16: minh_m8 h0.x(TRUE), |h1|, |h1.z|
+ 17: maxh h4.w(TRUE), h0, h1
+ 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n
+ 19: movr r1.zw(TRUE), v4.xxxy
+ 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww
+ 22: minh h5.w(TRUE), h0, h1
+ 23: texpkb h0(TRUE), r2.xzxx, #0
+ 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1
+ 27: maxh h4.x(TRUE), h2.z, h2.w
+ 28: texpkb h1(TRUE), r0.zwzz, #0
+ 30: addh_d2 h1(TRUE), h0, h1
+ 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 33: texpkb h0(TRUE), r0, #0
+ 35: minh h4.z(TRUE), h2, h2.w
+ 36: fenct TRUE
+ 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 39: texpkb h2(TRUE), r1, #0
+ 41: addh_d2 h0(TRUE), h0, h2
+ 42: maxh h2.w(TRUE), h4, h4.x
+ 43: minh h2.x(TRUE), h5.w, h4.z
+ 44: addh_d2 h0(TRUE), h0, h1
+ 45: slth h2.x(TRUE), h0.w, h2
+ 46: sgth h2.w(TRUE), h0, h2
+ 47: movh h0(TRUE), h0
+ 48: addx.c0 rc(TRUE), h2, h2.w
+ 49: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---;
+ | SCB1 | add | 10: ADDh h3.w, h0.---z, h1;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h2.w---, h0;
+ | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-;
+ | | |
+ 5 | SCT1 | mov | 15: NRMh h1.xz, h0;
+ | SRB | nrm | 15: NRMh h1.xz, h0;
+ | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|;
+ | SCB1 | max | 17: MAXh h4.w, h0, h1;
+ | | |
+ 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0;
+ | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy;
+ | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-;
+ | SCB1 | min | 22: MINh h5.w, h0, h1;
+ | | |
+ 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---;
+ | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1;
+ | | |
+ 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | SCB0/1 | add | 30: ADDh/2 h1, h0, h1;
+ | | |
+ 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB1 | min | 35: MINh h4.z, h2, h2.--w-;
+ | | |
+ 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | SCB0/1 | add | 41: ADDh/2 h0, h0, h2;
+ | | |
+ 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---;
+ | SCT1 | max | 42: MAXh h2.w, h4, h4.---x;
+ | SCB0/1 | add | 44: ADDh/2 h0, h0, h1;
+ | | |
+ 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2;
+ | SCT1 | set | 46: SGTh h2.w, h0, h2;
+ | SCB0/1 | mul | 47: MOVh h0, h0;
+ | | |
+ 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---;
+ | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1;
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 0% 0% 50%
+ 6: 100% 0% 75%
+ 7: 0% 100% 75%
+ 8: 0% 100% 100%
+ 9: 0% 100% 25%
+ 10: 0% 100% 100%
+ 11: 50% 0% 100%
+ 12: 50% 0% 100%
+ 13: 25% 0% 100%
+MEAN: 17% 61% 67%
-#extension GL_ARB_texture_rectangle : enable
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 0% 100%
+ 2: 0% 0% 100% 0% 100%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 0% 0% 0% 100% 100%
+ 6: 100% 100% 0% 100% 100%
+ 7: 0% 0% 100% 100% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 0% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 100% 100% 0% 100% 100%
+ 12: 100% 100% 0% 100% 100%
+ 13: 100% 0% 0% 100% 100%
+
+MEAN: 30% 23% 61% 76% 100%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 13 cycles, 3 r regs, 923,076,923 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O3
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 dir;
+ half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ lumaNe.w += half(1.0/512.0);
+ dir.x = -lumaNe.w;
+ dir.z = -lumaNe.w;
+ #else
+ lumaNe.y += half(1.0/512.0);
+ dir.x = -lumaNe.y;
+ dir.z = -lumaNe.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x += lumaSw.w;
+ dir.z += lumaSw.w;
+ #else
+ dir.x += lumaSw.y;
+ dir.z += lumaSw.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x -= lumaNw.w;
+ dir.z += lumaNw.w;
+ #else
+ dir.x -= lumaNw.y;
+ dir.z += lumaNw.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x += lumaSe.w;
+ dir.z -= lumaSe.w;
+ #else
+ dir.x += lumaSe.y;
+ dir.z -= lumaSe.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir.xyz).xz;
+ half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (7)
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (8)
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (11)
+ // compilier moves these scalar ops up to other cycles
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+ half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+ #else
+ half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y));
+ half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y));
+ #endif
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (12)
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+ #else
+ bool twoTapLt = rgby2.y < lumaMin;
+ bool twoTapGt = rgby2.y > lumaMax;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (13)
+ if(twoTapLt || twoTapGt) rgby2 = rgby1;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT)
+
+==============================================================================
+The code mostly matches the assembly.
+I have a feeling that 14 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks).
+Will look at fixing this for FXAA 3.12.
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h1.w(TRUE), v5.xwxx, #0
+ 6: addh h0.x(TRUE), h1.w, -h2.y
+ 7: texpkb h2.w(TRUE), v5.zwzz, #0
+ 9: minh h4.w(TRUE), h2.y, h2
+ 10: maxh h5.x(TRUE), h2.y, h2.w
+ 11: texpkb h0.w(TRUE), v5, #0
+ 13: addh h3.w(TRUE), -h0, h0.x
+ 14: addh h0.x(TRUE), h0.w, h0
+ 15: addh h0.z(TRUE), -h2.w, h0.x
+ 16: addh h0.x(TRUE), h2.w, h3.w
+ 17: minh h5.y(TRUE), h0.w, h1.w
+ 18: nrmh h2.xz(TRUE), h0_n
+ 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z|
+ 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w
+ 21: movr r1.zw(TRUE), v4.xxxy
+ 22: maxh h2.w(TRUE), h0, h1
+ 23: fenct TRUE
+ 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 26: texpkb h0(TRUE), r0, #0
+ 28: maxh h5.x(TRUE), h2.w, h5
+ 29: minh h5.w(TRUE), h5.y, h4
+ 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 32: texpkb h2(TRUE), r1, #0
+ 34: addh_d2 h2(TRUE), h0, h2
+ 35: texpkb h1(TRUE), v4, #0
+ 37: maxh h5.y(TRUE), h5.x, h1.w
+ 38: minh h4.w(TRUE), h1, h5
+ 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 41: texpkb h0(TRUE), r0, #0
+ 43: addh_m8 h5.z(TRUE), h5.y, -h4.w
+ 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 46: texpkb h3(TRUE), r2, #0
+ 48: addh_d2 h0(TRUE), h0, h3
+ 49: addh_d2 h3(TRUE), h0, h2
+ 50: movh h0(TRUE), h3
+ 51: slth h3.x(TRUE), h3.w, h5.w
+ 52: sgth h3.w(TRUE), h3, h5.x
+ 53: addx.c0 rc(TRUE), h3.x, h3
+ 54: slth.c0 rc(TRUE), h5.z, h5
+ 55: movh h0(c0.NE.w), h2
+ 56: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---;
+ | SCB1 | min | 9: MINh h4.w, h2.---y, h2;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h0.w---, h0;
+ | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x;
+ | | |
+ 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---;
+ | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-;
+ | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--;
+ | | |
+ 6 | SCT1 | mov | 18: NRMh h2.xz, h0;
+ | SRB | nrm | 18: NRMh h2.xz, h0;
+ | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|;
+ | | |
+ 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--;
+ | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy;
+ | SCB1 | max | 22: MAXh h2.w, h0, h1;
+ | | |
+ 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | SCB0 | max | 28: MAXh h5.x, h2.w---, h5;
+ | SCB1 | min | 29: MINh h5.w, h5.---y, h4;
+ | | |
+ 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | SCB0/1 | add | 34: ADDh/2 h2, h0, h2;
+ | | |
+ 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--;
+ | SCB1 | min | 38: MINh h4.w, h1, h5;
+ | | |
+ 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--;
+ | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--;
+ | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-;
+ | | |
+ 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | SCB0/1 | add | 48: ADDh/2 h0, h0, h3;
+ | | |
+ 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2;
+ | SCB0/1 | mul | 50: MOVh h0, h3;
+ | | |
+ 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---;
+ | SCT1 | set | 52: SGTh h3.w, h3, h5.---x;
+ | SCB0 | set | 54: SLThc0 rc, h5.z---, h5;
+ | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3;
+ | | |
+ 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2;
+ | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1;
+
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 50% 0% 25%
+ 6: 0% 0% 25%
+ 7: 100% 0% 25%
+ 8: 0% 100% 50%
+ 9: 0% 100% 100%
+ 10: 0% 100% 50%
+ 11: 0% 100% 75%
+ 12: 0% 100% 100%
+ 13: 100% 0% 100%
+ 14: 50% 0% 50%
+ 15: 100% 0% 100%
+
+MEAN: 26% 60% 56%
+
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 100% 0%
+ 2: 0% 0% 100% 100% 0%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 100% 100% 0% 100% 0%
+ 6: 0% 0% 0% 0% 100%
+ 7: 100% 100% 0% 0% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 100% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 0% 0% 100% 100% 100%
+ 12: 0% 0% 100% 100% 100%
+ 13: 100% 100% 0% 100% 100%
+ 14: 100% 100% 0% 100% 100%
+ 15: 100% 100% 0% 100% 100%
+
+MEAN: 33% 33% 60% 86% 80%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 15 cycles, 3 r regs, 800,000,000 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O2
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaNe = rgbyNe.w + half(1.0/512.0);
+ #else
+ half lumaNe = rgbyNe.y + half(1.0/512.0);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaSwNegNe = lumaSw.w - lumaNe;
+ #else
+ half lumaSwNegNe = lumaSw.y - lumaNe;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxNwSw = max(lumaNw.w, lumaSw.w);
+ half lumaMinNwSw = min(lumaNw.w, lumaSw.w);
+ #else
+ half lumaMaxNwSw = max(lumaNw.y, lumaSw.y);
+ half lumaMinNwSw = min(lumaNw.y, lumaSw.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half dirZ = lumaNw.w + lumaSwNegNe;
+ half dirX = -lumaNw.w + lumaSwNegNe;
+ #else
+ half dirZ = lumaNw.y + lumaSwNegNe;
+ half dirX = -lumaNw.y + lumaSwNegNe;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+ half3 dir;
+ dir.y = 0.0;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x = lumaSe.w + dirX;
+ dir.z = -lumaSe.w + dirZ;
+ half lumaMinNeSe = min(lumaNe, lumaSe.w);
+ #else
+ dir.x = lumaSe.y + dirX;
+ dir.z = -lumaSe.y + dirZ;
+ half lumaMinNeSe = min(lumaNe, lumaSe.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir).xz;
+ half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (7)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxNeSe = max(lumaNe, lumaSe.w);
+ #else
+ half lumaMaxNeSe = max(lumaNe, lumaSe.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (8)
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe);
+ half lumaMin = min(lumaMinNwSw, lumaMinNeSe);
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxM = max(lumaMax, rgbyM.w);
+ half lumaMinM = min(lumaMin, rgbyM.w);
+ #else
+ half lumaMaxM = max(lumaMax, rgbyM.y);
+ half lumaMinM = min(lumaMin, rgbyM.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (11)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD;
+/*--------------------------------------------------------------------------*/
+// (12)
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (13)
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (14)
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+ #else
+ bool twoTapLt = rgby2.y < lumaMin;
+ bool twoTapGt = rgby2.y > lumaMax;
+ #endif
+ bool earlyExit = lumaRangeM < lumaMax;
+ bool twoTap = twoTapLt || twoTapGt;
+/*--------------------------------------------------------------------------*/
+// (15)
+ if(twoTap) rgby2 = rgby1;
+ if(earlyExit) rgby2 = rgbyM;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect edgeMap;
+uniform sampler2D diffuseMap;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
-uniform sampler2D bloomMap;
+
+uniform vec2 tc_scale;
+uniform vec2 rcp_screen_res;
+uniform vec4 rcp_frame_opt;
+uniform vec4 rcp_frame_opt2;
+uniform vec2 screen_res;
uniform float depth_cutoff;
uniform float norm_cutoff;
@@ -41,9 +2095,10 @@ uniform float tan_pixel_angle;
uniform float magnification;
uniform mat4 inv_proj;
-uniform vec2 screen_res;
varying vec2 vary_fragcoord;
+varying vec2 vary_tc;
+
float getDepth(vec2 pos_screen)
{
@@ -76,8 +2131,8 @@ void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc)
float sc = calc_cof(d);
float wg = 0.25;
-
- vec4 s = texture2DRect(diffuseRect, tc);
+
+ vec4 s = texture2D(diffuseMap, tc*tc_scale/screen_res);
// de-weight dull areas to make highlights 'pop'
wg += s.r+s.g+s.b;
@@ -97,7 +2152,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve
{
float wg = 0.25;
- vec4 s = texture2DRect(diffuseRect, tc);
+ vec4 s = texture2D(diffuseMap, tc*tc_scale/screen_res);
// de-weight dull areas to make highlights 'pop'
wg += s.r+s.g+s.b;
@@ -107,7 +2162,6 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve
}
}
-
void main()
{
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
@@ -117,7 +2171,7 @@ void main()
float depth = getDepth(tc);
- vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
+ vec4 diff = texture2D(diffuseMap, vary_fragcoord.xy*tc_scale/screen_res);
{
float w = 1.0;
@@ -131,6 +2185,7 @@ void main()
// sample quite uniformly spaced points within a circle, for a circular 'bokeh'
//if (depth < focal_distance)
+ if (sc > 0.5)
{
while (sc > 0.5)
{
@@ -146,10 +2201,30 @@ void main()
sc -= 1.0;
}
}
+ else
+ {
+ diff = FxaaPixelShader(vary_tc, //pos
+ vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
+ diffuseMap, //tex
+ diffuseMap,
+ diffuseMap,
+ rcp_screen_res, //fxaaQualityRcpFrame
+ vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt
+ rcp_frame_opt, //fxaaConsoleRcpFrameOpt2
+ rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2
+ 0.75, //fxaaQualitySubpix
+ 0.166, //fxaaQualityEdgeThreshold
+ 0.0833, //fxaaQualityEdgeThresholdMin
+ 8.0, //fxaaConsoleEdgeSharpness
+ 0.125, //fxaaConsoleEdgeThreshold
+ 0.05, //fxaaConsoleEdgeThresholdMin
+ vec4(0,0,0,0)); //fxaaConsole360ConstDir
+
+
+ }
diff /= w;
}
- vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
- gl_FragColor = diff + bloom;
+ gl_FragColor = diff;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index 34e30a3070..f67615bdd5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -1,5 +1,5 @@
/**
- * @file postDeferredF.glsl
+ * @file postDeferredNoDoFF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -23,20 +23,2092 @@
* $/LicenseInfo$
*/
+#extension GL_ARB_texture_rectangle : enable
+#define FXAA_PC 1
+//#define FXAA_GLSL_130 1
+#define FXAA_QUALITY__PRESET 12
-#extension GL_ARB_texture_rectangle : enable
+/*============================================================================
+
+
+ NVIDIA FXAA 3.11 by TIMOTHY LOTTES
+
+
+------------------------------------------------------------------------------
+COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
+------------------------------------------------------------------------------
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA
+OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
+OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
+THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+------------------------------------------------------------------------------
+ INTEGRATION CHECKLIST
+------------------------------------------------------------------------------
+(1.)
+In the shader source, setup defines for the desired configuration.
+When providing multiple shaders (for different presets),
+simply setup the defines differently in multiple files.
+Example,
+
+ #define FXAA_PC 1
+ #define FXAA_HLSL_5 1
+ #define FXAA_QUALITY__PRESET 12
+
+Or,
+
+ #define FXAA_360 1
+
+Or,
+
+ #define FXAA_PS3 1
+
+Etc.
+
+(2.)
+Then include this file,
+
+ #include "Fxaa3_11.h"
+
+(3.)
+Then call the FXAA pixel shader from within your desired shader.
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+As for FXAA 3.11 all inputs for all shaders are the same
+to enable easy porting between platforms.
+
+ return FxaaPixelShader(...);
+
+(4.)
+Insure pass prior to FXAA outputs RGBL (see next section).
+Or use,
+
+ #define FXAA_GREEN_AS_LUMA 1
+
+(5.)
+Setup engine to provide the following constants
+which are used in the FxaaPixelShader() inputs,
+
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+
+(6.)
+Have FXAA vertex shader run as a full screen triangle,
+and output "pos" and "fxaaConsolePosPos"
+such that inputs in the pixel shader provide,
+
+ // {xy} = center of pixel
+ FxaaFloat2 pos,
+
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ FxaaFloat4 fxaaConsolePosPos,
+
+(7.)
+Insure the texture sampler(s) used by FXAA are set to bilinear filtering.
+
+
+------------------------------------------------------------------------------
+ INTEGRATION - RGBL AND COLORSPACE
+------------------------------------------------------------------------------
+FXAA3 requires RGBL as input unless the following is set,
+
+ #define FXAA_GREEN_AS_LUMA 1
+
+In which case the engine uses green in place of luma,
+and requires RGB input is in a non-linear colorspace.
+
+RGB should be LDR (low dynamic range).
+Specifically do FXAA after tonemapping.
+
+RGB data as returned by a texture fetch can be non-linear,
+or linear when FXAA_GREEN_AS_LUMA is not set.
+Note an "sRGB format" texture counts as linear,
+because the result of a texture fetch is linear data.
+Regular "RGBA8" textures in the sRGB colorspace are non-linear.
+
+If FXAA_GREEN_AS_LUMA is not set,
+luma must be stored in the alpha channel prior to running FXAA.
+This luma should be in a perceptual space (could be gamma 2.0).
+Example pass before FXAA where output is gamma 2.0 encoded,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.rgb = sqrt(color.rgb); // gamma 2.0 color output
+ color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma
+ return color;
+
+Another example where output is linear encoded,
+say for instance writing to an sRGB formated render target,
+where the render target does the conversion back to sRGB after blending,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ return color;
+
+To use FXAA,
+
+ color.rgb = ToneMap(color.rgb); // linear color output
+ color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma
+ return color;
+
+Getting luma correct is required for the algorithm to work correctly.
+
+
+------------------------------------------------------------------------------
+ BEING LINEARLY CORRECT?
+------------------------------------------------------------------------------
+Applying FXAA to a framebuffer with linear RGB color will look worse.
+This is very counter intuitive, but happends to be true in this case.
+The reason is because dithering artifacts will be more visiable
+in a linear colorspace.
+
+
+------------------------------------------------------------------------------
+ COMPLEX INTEGRATION
+------------------------------------------------------------------------------
+Q. What if the engine is blending into RGB before wanting to run FXAA?
+
+A. In the last opaque pass prior to FXAA,
+ have the pass write out luma into alpha.
+ Then blend into RGB only.
+ FXAA should be able to run ok
+ assuming the blending pass did not any add aliasing.
+ This should be the common case for particles and common blending passes.
+
+A. Or use FXAA_GREEN_AS_LUMA.
+
+============================================================================*/
+
+/*============================================================================
+
+ INTEGRATION KNOBS
+
+============================================================================*/
+//
+// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE).
+// FXAA_360_OPT is a prototype for the new optimized 360 version.
+//
+// 1 = Use API.
+// 0 = Don't use API.
+//
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PS3
+ #define FXAA_PS3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360
+ #define FXAA_360 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_360_OPT
+ #define FXAA_360_OPT 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_PC
+ //
+ // FXAA Quality
+ // The high quality PC algorithm.
+ //
+ #define FXAA_PC 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_PC_CONSOLE
+ //
+ // The console algorithm for PC is included
+ // for developers targeting really low spec machines.
+ // Likely better to just run FXAA_PC, and use a really low preset.
+ //
+ #define FXAA_PC_CONSOLE 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_120
+ #define FXAA_GLSL_120 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_130
+ #define FXAA_GLSL_130 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_3
+ #define FXAA_HLSL_3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_4
+ #define FXAA_HLSL_4 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_5
+ #define FXAA_HLSL_5 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_GREEN_AS_LUMA
+ //
+ // For those using non-linear color,
+ // and either not able to get luma in alpha, or not wanting to,
+ // this enables FXAA to run using green as a proxy for luma.
+ // So with this enabled, no need to pack luma in alpha.
+ //
+ // This will turn off AA on anything which lacks some amount of green.
+ // Pure red and blue or combination of only R and B, will get no AA.
+ //
+ // Might want to lower the settings for both,
+ // fxaaConsoleEdgeThresholdMin
+ // fxaaQualityEdgeThresholdMin
+ // In order to insure AA does not get turned off on colors
+ // which contain a minor amount of green.
+ //
+ // 1 = On.
+ // 0 = Off.
+ //
+ #define FXAA_GREEN_AS_LUMA 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_EARLY_EXIT
+ //
+ // Controls algorithm's early exit path.
+ // On PS3 turning this ON adds 2 cycles to the shader.
+ // On 360 turning this OFF adds 10ths of a millisecond to the shader.
+ // Turning this off on console will result in a more blurry image.
+ // So this defaults to on.
+ //
+ // 1 = On.
+ // 0 = Off.
+ //
+ #define FXAA_EARLY_EXIT 1
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_DISCARD
+ //
+ // Only valid for PC OpenGL currently.
+ // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
+ //
+ // 1 = Use discard on pixels which don't need AA.
+ // For APIs which enable concurrent TEX+ROP from same surface.
+ // 0 = Return unchanged color on pixels which don't need AA.
+ //
+ #define FXAA_DISCARD 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_FAST_PIXEL_OFFSET
+ //
+ // Used for GLSL 120 only.
+ //
+ // 1 = GL API supports fast pixel offsets
+ // 0 = do not use fast pixel offsets
+ //
+ #ifdef GL_EXT_gpu_shader4
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_FAST_PIXEL_OFFSET 1
+ #endif
+ #ifndef FXAA_FAST_PIXEL_OFFSET
+ #define FXAA_FAST_PIXEL_OFFSET 0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GATHER4_ALPHA
+ //
+ // 1 = API supports gather4 on alpha channel.
+ // 0 = API does not support gather4 on alpha channel.
+ //
+ #if (FXAA_HLSL_5 == 1)
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_ARB_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifdef GL_NV_gpu_shader5
+ #define FXAA_GATHER4_ALPHA 1
+ #endif
+ #ifndef FXAA_GATHER4_ALPHA
+ #define FXAA_GATHER4_ALPHA 0
+ #endif
+#endif
+
+/*============================================================================
+ FXAA CONSOLE PS3 - TUNING KNOBS
+============================================================================*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS
+ //
+ // Consoles the sharpness of edges on PS3 only.
+ // Non-PS3 tuning is done with shader input.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 4 and 8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ //
+ // 8.0 is sharper
+ // 4.0 is softer
+ // 2.0 is really soft (good for vector graphics inputs)
+ //
+ #if 1
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0
+ #endif
+ #if 0
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0
+ #endif
+ #if 0
+ #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD
+ //
+ // Only effects PS3.
+ // Non-PS3 tuning is done with shader input.
+ //
+ // The minimum amount of local contrast required to apply algorithm.
+ // The console setting has a different mapping than the quality setting.
+ //
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ //
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 0.25 and 0.125.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ //
+ // 0.125 leaves less aliasing, but is softer
+ // 0.25 leaves more aliasing, and is sharper
+ //
+ #if 1
+ #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125
+ #else
+ #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25
+ #endif
+#endif
+
+/*============================================================================
+ FXAA QUALITY - TUNING KNOBS
+------------------------------------------------------------------------------
+NOTE the other tuning knobs are now in the shader function inputs!
+============================================================================*/
+#ifndef FXAA_QUALITY__PRESET
+ //
+ // Choose the quality preset.
+ // This needs to be compiled into the shader as it effects code.
+ // Best option to include multiple presets is to
+ // in each shader define the preset, then include this file.
+ //
+ // OPTIONS
+ // -----------------------------------------------------------------------
+ // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
+ // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
+ // 39 - no dither, very expensive
+ //
+ // NOTES
+ // -----------------------------------------------------------------------
+ // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
+ // 13 = about same speed as FXAA 3.9 and better than 12
+ // 23 = closest to FXAA 3.9 visually and performance wise
+ // _ = the lowest digit is directly related to performance
+ // _ = the highest digit is directly related to style
+ //
+ #define FXAA_QUALITY__PRESET 12
+#endif
+
+
+/*============================================================================
+
+ FXAA QUALITY - PRESETS
+
+============================================================================*/
+
+/*============================================================================
+ FXAA QUALITY - MEDIUM DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 10)
+ #define FXAA_QUALITY__PS 3
+ #define FXAA_QUALITY__P0 1.5
+ #define FXAA_QUALITY__P1 3.0
+ #define FXAA_QUALITY__P2 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 11)
+ #define FXAA_QUALITY__PS 4
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 3.0
+ #define FXAA_QUALITY__P3 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 12)
+ #define FXAA_QUALITY__PS 5
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 4.0
+ #define FXAA_QUALITY__P4 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 13)
+ #define FXAA_QUALITY__PS 6
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 4.0
+ #define FXAA_QUALITY__P5 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 14)
+ #define FXAA_QUALITY__PS 7
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 4.0
+ #define FXAA_QUALITY__P6 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 15)
+ #define FXAA_QUALITY__PS 8
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 4.0
+ #define FXAA_QUALITY__P7 12.0
+#endif
+
+/*============================================================================
+ FXAA QUALITY - LOW DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 20)
+ #define FXAA_QUALITY__PS 3
+ #define FXAA_QUALITY__P0 1.5
+ #define FXAA_QUALITY__P1 2.0
+ #define FXAA_QUALITY__P2 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 21)
+ #define FXAA_QUALITY__PS 4
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 22)
+ #define FXAA_QUALITY__PS 5
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 23)
+ #define FXAA_QUALITY__PS 6
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 24)
+ #define FXAA_QUALITY__PS 7
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 3.0
+ #define FXAA_QUALITY__P6 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 25)
+ #define FXAA_QUALITY__PS 8
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 4.0
+ #define FXAA_QUALITY__P7 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 26)
+ #define FXAA_QUALITY__PS 9
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 4.0
+ #define FXAA_QUALITY__P8 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 27)
+ #define FXAA_QUALITY__PS 10
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 4.0
+ #define FXAA_QUALITY__P9 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 28)
+ #define FXAA_QUALITY__PS 11
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 4.0
+ #define FXAA_QUALITY__P10 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 29)
+ #define FXAA_QUALITY__PS 12
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.5
+ #define FXAA_QUALITY__P2 2.0
+ #define FXAA_QUALITY__P3 2.0
+ #define FXAA_QUALITY__P4 2.0
+ #define FXAA_QUALITY__P5 2.0
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 2.0
+ #define FXAA_QUALITY__P10 4.0
+ #define FXAA_QUALITY__P11 8.0
+#endif
-uniform sampler2DRect diffuseRect;
-uniform sampler2D bloomMap;
+/*============================================================================
+ FXAA QUALITY - EXTREME QUALITY
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 39)
+ #define FXAA_QUALITY__PS 12
+ #define FXAA_QUALITY__P0 1.0
+ #define FXAA_QUALITY__P1 1.0
+ #define FXAA_QUALITY__P2 1.0
+ #define FXAA_QUALITY__P3 1.0
+ #define FXAA_QUALITY__P4 1.0
+ #define FXAA_QUALITY__P5 1.5
+ #define FXAA_QUALITY__P6 2.0
+ #define FXAA_QUALITY__P7 2.0
+ #define FXAA_QUALITY__P8 2.0
+ #define FXAA_QUALITY__P9 2.0
+ #define FXAA_QUALITY__P10 4.0
+ #define FXAA_QUALITY__P11 8.0
+#endif
+
+
+/*============================================================================
+
+ API PORTING
+
+============================================================================*/
+#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
+ #define FxaaBool bool
+ #define FxaaDiscard discard
+ #define FxaaFloat float
+ #define FxaaFloat2 vec2
+ #define FxaaFloat3 vec3
+ #define FxaaFloat4 vec4
+ #define FxaaHalf float
+ #define FxaaHalf2 vec2
+ #define FxaaHalf3 vec3
+ #define FxaaHalf4 vec4
+ #define FxaaInt2 ivec2
+ #define FxaaSat(x) clamp(x, 0.0, 1.0)
+ #define FxaaTex sampler2D
+#else
+ #define FxaaBool bool
+ #define FxaaDiscard clip(-1)
+ #define FxaaFloat float
+ #define FxaaFloat2 float2
+ #define FxaaFloat3 float3
+ #define FxaaFloat4 float4
+ #define FxaaHalf half
+ #define FxaaHalf2 half2
+ #define FxaaHalf3 half3
+ #define FxaaHalf4 half4
+ #define FxaaSat(x) saturate(x)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_120 == 1)
+ // Requires,
+ // #version 120
+ // And at least,
+ // #extension GL_EXT_gpu_shader4 : enable
+ // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
+ #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
+ #if (FXAA_FAST_PIXEL_OFFSET == 1)
+ #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
+ #else
+ #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
+ #endif
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+ #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+ #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_130 == 1)
+ // Requires "#version 130" or better
+ #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
+ #if (FXAA_GATHER4_ALPHA == 1)
+ // use #extension GL_ARB_gpu_shader5 : enable
+ #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+ #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+ #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+ #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+ #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1)
+ #define FxaaInt2 float2
+ #define FxaaTex sampler2D
+ #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
+ #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_4 == 1)
+ #define FxaaInt2 int2
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_5 == 1)
+ #define FxaaInt2 int2
+ struct FxaaTex { SamplerState smpl; Texture2D tex; };
+ #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+ #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+ #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
+ #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
+ #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
+ #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
+#endif
+
+
+/*============================================================================
+ GREEN AS LUMA OPTION SUPPORT FUNCTION
+============================================================================*/
+#if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
+#else
+ FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
+#endif
+
+
+
+
+/*============================================================================
+
+ FXAA3 QUALITY - PC
+
+============================================================================*/
+#if (FXAA_PC == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+ //
+ // Use noperspective interpolation here (turn off perspective interpolation).
+ // {xy} = center of pixel
+ FxaaFloat2 pos,
+ //
+ // Used only for FXAA Console, and not used on the 360 version.
+ // Use noperspective interpolation here (turn off perspective interpolation).
+ // {xy__} = upper left of pixel
+ // {__zw} = lower right of pixel
+ FxaaFloat4 fxaaConsolePosPos,
+ //
+ // Input color texture.
+ // {rgb_} = color in linear or perceptual color space
+ // if (FXAA_GREEN_AS_LUMA == 0)
+ // {___a} = luma in perceptual color space (not linear)
+ FxaaTex tex,
+ //
+ // Only used on the optimized 360 version of FXAA Console.
+ // For everything but 360, just use the same input here as for "tex".
+ // For 360, same texture, just alias with a 2nd sampler.
+ // This sampler needs to have an exponent bias of -1.
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ //
+ // Only used on the optimized 360 version of FXAA Console.
+ // For everything but 360, just use the same input here as for "tex".
+ // For 360, same texture, just alias with a 3nd sampler.
+ // This sampler needs to have an exponent bias of -2.
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ //
+ // Only used on FXAA Quality.
+ // This must be from a constant/uniform.
+ // {x_} = 1.0/screenWidthInPixels
+ // {_y} = 1.0/screenHeightInPixels
+ FxaaFloat2 fxaaQualityRcpFrame,
+ //
+ // Only used on FXAA Console.
+ // This must be from a constant/uniform.
+ // This effects sub-pixel AA quality and inversely sharpness.
+ // Where N ranges between,
+ // N = 0.50 (default)
+ // N = 0.33 (sharper)
+ // {x___} = -N/screenWidthInPixels
+ // {_y__} = -N/screenHeightInPixels
+ // {__z_} = N/screenWidthInPixels
+ // {___w} = N/screenHeightInPixels
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ //
+ // Only used on FXAA Console.
+ // Not used on 360, but used on PS3 and PC.
+ // This must be from a constant/uniform.
+ // {x___} = -2.0/screenWidthInPixels
+ // {_y__} = -2.0/screenHeightInPixels
+ // {__z_} = 2.0/screenWidthInPixels
+ // {___w} = 2.0/screenHeightInPixels
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ //
+ // Only used on FXAA Console.
+ // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
+ // This must be from a constant/uniform.
+ // {x___} = 8.0/screenWidthInPixels
+ // {_y__} = 8.0/screenHeightInPixels
+ // {__z_} = -4.0/screenWidthInPixels
+ // {___w} = -4.0/screenHeightInPixels
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__SUBPIX define.
+ // It is here now to allow easier tuning.
+ // Choose the amount of sub-pixel aliasing removal.
+ // This can effect sharpness.
+ // 1.00 - upper limit (softer)
+ // 0.75 - default amount of filtering
+ // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
+ // 0.25 - almost off
+ // 0.00 - completely off
+ FxaaFloat fxaaQualitySubpix,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.
+ // It is here now to allow easier tuning.
+ // The minimum amount of local contrast required to apply algorithm.
+ // 0.333 - too little (faster)
+ // 0.250 - low quality
+ // 0.166 - default
+ // 0.125 - high quality
+ // 0.063 - overkill (slower)
+ FxaaFloat fxaaQualityEdgeThreshold,
+ //
+ // Only used on FXAA Quality.
+ // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.
+ // It is here now to allow easier tuning.
+ // Trims the algorithm from processing darks.
+ // 0.0833 - upper limit (default, the start of visible unfiltered edges)
+ // 0.0625 - high quality (faster)
+ // 0.0312 - visible limit (slower)
+ // Special notes when using FXAA_GREEN_AS_LUMA,
+ // Likely want to set this to zero.
+ // As colors that are mostly not-green
+ // will appear very dark in the green channel!
+ // Tune by looking at mostly non-green content,
+ // then start at zero and increase until aliasing is a problem.
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
+ // It is here now to allow easier tuning.
+ // This does not effect PS3, as this needs to be compiled in.
+ // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
+ // Due to the PS3 being ALU bound,
+ // there are only three safe values here: 2 and 4 and 8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ // For all other platforms can be a non-power of two.
+ // 8.0 is sharper (default!!!)
+ // 4.0 is softer
+ // 2.0 is really soft (good only for vector graphics inputs)
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
+ // It is here now to allow easier tuning.
+ // This does not effect PS3, as this needs to be compiled in.
+ // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
+ // Due to the PS3 being ALU bound,
+ // there are only two safe values here: 1/4 and 1/8.
+ // These options use the shaders ability to a free *|/ by 2|4|8.
+ // The console setting has a different mapping than the quality setting.
+ // Other platforms can use other values.
+ // 0.125 leaves less aliasing, but is softer (default!!!)
+ // 0.25 leaves more aliasing, and is sharper
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ //
+ // Only used on FXAA Console.
+ // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.
+ // It is here now to allow easier tuning.
+ // Trims the algorithm from processing darks.
+ // The console setting has a different mapping than the quality setting.
+ // This only applies when FXAA_EARLY_EXIT is 1.
+ // This does not apply to PS3,
+ // PS3 was simplified to avoid more shader instructions.
+ // 0.06 - faster but more aliasing in darks
+ // 0.05 - default
+ // 0.04 - slower and less aliasing in darks
+ // Special notes when using FXAA_GREEN_AS_LUMA,
+ // Likely want to set this to zero.
+ // As colors that are mostly not-green
+ // will appear very dark in the green channel!
+ // Tune by looking at mostly non-green content,
+ // then start at zero and increase until aliasing is a problem.
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ //
+ // Extra constants for 360 FXAA Console only.
+ // Use zeros or anything else for other platforms.
+ // These must be in physical constant registers and NOT immedates.
+ // Immedates will result in compiler un-optimizing.
+ // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posM;
+ posM.x = pos.x;
+ posM.y = pos.y;
+ #if (FXAA_GATHER4_ALPHA == 1)
+ #if (FXAA_DISCARD == 0)
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ #define lumaM rgbyM.w
+ #else
+ #define lumaM rgbyM.y
+ #endif
+ #endif
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
+ FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
+ #else
+ FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
+ FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
+ #endif
+ #if (FXAA_DISCARD == 1)
+ #define lumaM luma4A.w
+ #endif
+ #define lumaE luma4A.z
+ #define lumaS luma4A.x
+ #define lumaSE luma4A.y
+ #define lumaNW luma4B.w
+ #define lumaN luma4B.z
+ #define lumaW luma4B.x
+ #else
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ #define lumaM rgbyM.w
+ #else
+ #define lumaM rgbyM.y
+ #endif
+ FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat maxSM = max(lumaS, lumaM);
+ FxaaFloat minSM = min(lumaS, lumaM);
+ FxaaFloat maxESM = max(lumaE, maxSM);
+ FxaaFloat minESM = min(lumaE, minSM);
+ FxaaFloat maxWN = max(lumaN, lumaW);
+ FxaaFloat minWN = min(lumaN, lumaW);
+ FxaaFloat rangeMax = max(maxWN, maxESM);
+ FxaaFloat rangeMin = min(minWN, minESM);
+ FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
+ FxaaFloat range = rangeMax - rangeMin;
+ FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
+ FxaaBool earlyExit = range < rangeMaxClamped;
+/*--------------------------------------------------------------------------*/
+ if(earlyExit)
+ #if (FXAA_DISCARD == 1)
+ FxaaDiscard;
+ #else
+ return rgbyM;
+ #endif
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GATHER4_ALPHA == 0)
+ FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+ #else
+ FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
+ FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNS = lumaN + lumaS;
+ FxaaFloat lumaWE = lumaW + lumaE;
+ FxaaFloat subpixRcpRange = 1.0/range;
+ FxaaFloat subpixNSWE = lumaNS + lumaWE;
+ FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
+ FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNESE = lumaNE + lumaSE;
+ FxaaFloat lumaNWNE = lumaNW + lumaNE;
+ FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
+ FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNWSW = lumaNW + lumaSW;
+ FxaaFloat lumaSWSE = lumaSW + lumaSE;
+ FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
+ FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
+ FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
+ FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
+ FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
+ FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
+ FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
+ FxaaBool horzSpan = edgeHorz >= edgeVert;
+ FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
+/*--------------------------------------------------------------------------*/
+ if(!horzSpan) lumaN = lumaW;
+ if(!horzSpan) lumaS = lumaE;
+ if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
+ FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat gradientN = lumaN - lumaM;
+ FxaaFloat gradientS = lumaS - lumaM;
+ FxaaFloat lumaNN = lumaN + lumaM;
+ FxaaFloat lumaSS = lumaS + lumaM;
+ FxaaBool pairN = abs(gradientN) >= abs(gradientS);
+ FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
+ if(pairN) lengthSign = -lengthSign;
+ FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posB;
+ posB.x = posM.x;
+ posB.y = posM.y;
+ FxaaFloat2 offNP;
+ offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
+ offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
+ if(!horzSpan) posB.x += lengthSign * 0.5;
+ if( horzSpan) posB.y += lengthSign * 0.5;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 posN;
+ posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
+ posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
+ FxaaFloat2 posP;
+ posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
+ posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
+ FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
+ FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
+ FxaaFloat subpixE = subpixC * subpixC;
+ FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
+/*--------------------------------------------------------------------------*/
+ if(!pairN) lumaNN = lumaSS;
+ FxaaFloat gradientScaled = gradient * 1.0/4.0;
+ FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
+ FxaaFloat subpixF = subpixD * subpixE;
+ FxaaBool lumaMLTZero = lumaMM < 0.0;
+/*--------------------------------------------------------------------------*/
+ lumaEndN -= lumaNN * 0.5;
+ lumaEndP -= lumaNN * 0.5;
+ FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
+ FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
+ FxaaBool doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
+/*--------------------------------------------------------------------------*/
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 3)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 4)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 5)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 6)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 7)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 8)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 9)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 10)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 11)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_QUALITY__PS > 12)
+ if(doneNP) {
+ if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+ if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+ if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+ if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+ doneN = abs(lumaEndN) >= gradientScaled;
+ doneP = abs(lumaEndP) >= gradientScaled;
+ if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
+ if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
+ doneNP = (!doneN) || (!doneP);
+ if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
+ if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+ #endif
+/*--------------------------------------------------------------------------*/
+ }
+/*--------------------------------------------------------------------------*/
+ FxaaFloat dstN = posM.x - posN.x;
+ FxaaFloat dstP = posP.x - posM.x;
+ if(!horzSpan) dstN = posM.y - posN.y;
+ if(!horzSpan) dstP = posP.y - posM.y;
+/*--------------------------------------------------------------------------*/
+ FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
+ FxaaFloat spanLength = (dstP + dstN);
+ FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
+ FxaaFloat spanLengthRcp = 1.0/spanLength;
+/*--------------------------------------------------------------------------*/
+ FxaaBool directionN = dstN < dstP;
+ FxaaFloat dst = min(dstN, dstP);
+ FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
+ FxaaFloat subpixG = subpixF * subpixF;
+ FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
+ FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
+ FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
+ if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
+ if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
+ #if (FXAA_DISCARD == 1)
+ return FxaaTexTop(tex, posM);
+ #else
+ return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
+ #endif
+}
+/*==========================================================================*/
+#endif
+
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - PC VERSION
+
+------------------------------------------------------------------------------
+Instead of using this on PC, I'd suggest just using FXAA Quality with
+ #define FXAA_QUALITY__PRESET 10
+Or
+ #define FXAA_QUALITY__PRESET 20
+Either are higher qualilty and almost as fast as this on modern PC GPUs.
+============================================================================*/
+#if (FXAA_PC_CONSOLE == 1)
+/*--------------------------------------------------------------------------*/
+FxaaFloat4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy));
+ FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw));
+ FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy));
+ FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw));
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy);
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaFloat lumaM = rgbyM.w;
+ #else
+ FxaaFloat lumaM = rgbyM.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw);
+ lumaNe += 1.0/384.0;
+ FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe);
+ FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);
+ FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat lumaMinM = min(lumaMin, lumaM);
+ FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
+ FxaaFloat lumaMaxM = max(lumaMax, lumaM);
+ FxaaFloat dirSwMinusNe = lumaSw - lumaNe;
+ FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM;
+ FxaaFloat dirSeMinusNw = lumaSe - lumaNw;
+ if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 dir;
+ dir.x = dirSwMinusNe + dirSeMinusNw;
+ dir.y = dirSwMinusNe - dirSeMinusNw;
+/*--------------------------------------------------------------------------*/
+ FxaaFloat2 dir1 = normalize(dir.xy);
+ FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw);
+ FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;
+ FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw);
+ FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw);
+/*--------------------------------------------------------------------------*/
+ FxaaFloat4 rgbyA = rgbyN1 + rgbyP1;
+ FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);
+/*--------------------------------------------------------------------------*/
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax);
+ #else
+ FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax);
+ #endif
+ if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5;
+ return rgbyB; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - 360 PIXEL SHADER
+
+------------------------------------------------------------------------------
+This optimized version thanks to suggestions from Andy Luedke.
+Should be fully tex bound in all cases.
+As of the FXAA 3.11 release, I have still not tested this code,
+however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10.
+And note this is replacing the old unoptimized version.
+If it does not work, please let me know so I can fix it.
+============================================================================*/
+#if (FXAA_360 == 1)
+/*--------------------------------------------------------------------------*/
+[reduceTempRegUsage(4)]
+float4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+ float4 lumaNwNeSwSe;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ asm {
+ tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false
+ };
+ #else
+ asm {
+ tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false
+ tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false
+ };
+ #endif
+/*--------------------------------------------------------------------------*/
+ lumaNwNeSwSe.y += 1.0/384.0;
+ float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+ float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw);
+ float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y);
+ float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y);
+/*--------------------------------------------------------------------------*/
+ float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ float lumaMinM = min(lumaMin, rgbyM.w);
+ float lumaMaxM = max(lumaMax, rgbyM.w);
+ #else
+ float lumaMinM = min(lumaMin, rgbyM.y);
+ float lumaMaxM = max(lumaMax, rgbyM.y);
+ #endif
+ if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM;
+/*--------------------------------------------------------------------------*/
+ float2 dir;
+ dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx);
+ dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy);
+ dir = normalize(dir);
+/*--------------------------------------------------------------------------*/
+ float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw;
+/*--------------------------------------------------------------------------*/
+ float4 dir2;
+ float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness;
+ dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5);
+ dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw;
+/*--------------------------------------------------------------------------*/
+ float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0));
+ float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0));
+ float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0));
+ float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+ float4 rgbyA = rgbyN1 + rgbyP1;
+ float4 rgbyB = rgbyN2 + rgbyP2 * 0.5 + rgbyA;
+/*--------------------------------------------------------------------------*/
+ float4 rgbyR = ((rgbyB.w - lumaMax) > 0.0) ? rgbyA : rgbyB;
+ rgbyR = ((rgbyB.w - lumaMin) > 0.0) ? rgbyR : rgbyA;
+ return rgbyR; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT)
+
+==============================================================================
+The code below does not exactly match the assembly.
+I have a feeling that 12 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h0.w(TRUE), v5.xwxx, #0
+ 6: addh h0.z(TRUE), -h2, h0.w
+ 7: texpkb h1.w(TRUE), v5, #0
+ 9: addh h0.x(TRUE), h0.z, -h1.w
+ 10: addh h3.w(TRUE), h0.z, h1
+ 11: texpkb h2.w(TRUE), v5.zwzz, #0
+ 13: addh h0.z(TRUE), h3.w, -h2.w
+ 14: addh h0.x(TRUE), h2.w, h0
+ 15: nrmh h1.xz(TRUE), h0_n
+ 16: minh_m8 h0.x(TRUE), |h1|, |h1.z|
+ 17: maxh h4.w(TRUE), h0, h1
+ 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n
+ 19: movr r1.zw(TRUE), v4.xxxy
+ 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww
+ 22: minh h5.w(TRUE), h0, h1
+ 23: texpkb h0(TRUE), r2.xzxx, #0
+ 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1
+ 27: maxh h4.x(TRUE), h2.z, h2.w
+ 28: texpkb h1(TRUE), r0.zwzz, #0
+ 30: addh_d2 h1(TRUE), h0, h1
+ 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 33: texpkb h0(TRUE), r0, #0
+ 35: minh h4.z(TRUE), h2, h2.w
+ 36: fenct TRUE
+ 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 39: texpkb h2(TRUE), r1, #0
+ 41: addh_d2 h0(TRUE), h0, h2
+ 42: maxh h2.w(TRUE), h4, h4.x
+ 43: minh h2.x(TRUE), h5.w, h4.z
+ 44: addh_d2 h0(TRUE), h0, h1
+ 45: slth h2.x(TRUE), h0.w, h2
+ 46: sgth h2.w(TRUE), h0, h2
+ 47: movh h0(TRUE), h0
+ 48: addx.c0 rc(TRUE), h2, h2.w
+ 49: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---;
+ | SCB1 | add | 10: ADDh h3.w, h0.---z, h1;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h2.w---, h0;
+ | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-;
+ | | |
+ 5 | SCT1 | mov | 15: NRMh h1.xz, h0;
+ | SRB | nrm | 15: NRMh h1.xz, h0;
+ | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|;
+ | SCB1 | max | 17: MAXh h4.w, h0, h1;
+ | | |
+ 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0;
+ | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy;
+ | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-;
+ | SCB1 | min | 22: MINh h5.w, h0, h1;
+ | | |
+ 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0;
+ | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---;
+ | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1;
+ | | |
+ 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0;
+ | SCB0/1 | add | 30: ADDh/2 h1, h0, h1;
+ | | |
+ 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB1 | min | 35: MINh h4.z, h2, h2.--w-;
+ | | |
+ 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--;
+ | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0;
+ | SCB0/1 | add | 41: ADDh/2 h0, h0, h2;
+ | | |
+ 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---;
+ | SCT1 | max | 42: MAXh h2.w, h4, h4.---x;
+ | SCB0/1 | add | 44: ADDh/2 h0, h0, h1;
+ | | |
+ 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2;
+ | SCT1 | set | 46: SGTh h2.w, h0, h2;
+ | SCB0/1 | mul | 47: MOVh h0, h0;
+ | | |
+ 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---;
+ | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1;
+
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 0% 0% 50%
+ 6: 100% 0% 75%
+ 7: 0% 100% 75%
+ 8: 0% 100% 100%
+ 9: 0% 100% 25%
+ 10: 0% 100% 100%
+ 11: 50% 0% 100%
+ 12: 50% 0% 100%
+ 13: 25% 0% 100%
+
+MEAN: 17% 61% 67%
+
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 0% 100%
+ 2: 0% 0% 100% 0% 100%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 0% 0% 0% 100% 100%
+ 6: 100% 100% 0% 100% 100%
+ 7: 0% 0% 100% 100% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 0% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 100% 100% 0% 100% 100%
+ 12: 100% 100% 0% 100% 100%
+ 13: 100% 0% 0% 100% 100%
+
+MEAN: 30% 23% 61% 76% 100%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 13 cycles, 3 r regs, 923,076,923 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O3
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 dir;
+ half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ lumaNe.w += half(1.0/512.0);
+ dir.x = -lumaNe.w;
+ dir.z = -lumaNe.w;
+ #else
+ lumaNe.y += half(1.0/512.0);
+ dir.x = -lumaNe.y;
+ dir.z = -lumaNe.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x += lumaSw.w;
+ dir.z += lumaSw.w;
+ #else
+ dir.x += lumaSw.y;
+ dir.z += lumaSw.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x -= lumaNw.w;
+ dir.z += lumaNw.w;
+ #else
+ dir.x -= lumaNw.y;
+ dir.z += lumaNw.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x += lumaSe.w;
+ dir.z -= lumaSe.w;
+ #else
+ dir.x += lumaSe.y;
+ dir.z -= lumaSe.y;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir.xyz).xz;
+ half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (7)
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+/*--------------------------------------------------------------------------*/
+// (8)
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (11)
+ // compilier moves these scalar ops up to other cycles
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w));
+ half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w));
+ #else
+ half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y));
+ half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y));
+ #endif
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (12)
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+ #else
+ bool twoTapLt = rgby2.y < lumaMin;
+ bool twoTapGt = rgby2.y > lumaMax;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (13)
+ if(twoTapLt || twoTapGt) rgby2 = rgby1;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+
+
+/*============================================================================
+
+ FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT)
+
+==============================================================================
+The code mostly matches the assembly.
+I have a feeling that 14 cycles is possible, but was not able to get there.
+Might have to increase register count to get full performance.
+Note this shader does not use perspective interpolation.
+
+Use the following cgc options,
+
+ --fenable-bx2 --fastmath --fastprecision --nofloatbindings
+
+Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks).
+Will look at fixing this for FXAA 3.12.
+------------------------------------------------------------------------------
+ NVSHADERPERF OUTPUT
+------------------------------------------------------------------------------
+For reference and to aid in debug, output of NVShaderPerf should match this,
+
+Shader to schedule:
+ 0: texpkb h0.w(TRUE), v5.zyxx, #0
+ 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x
+ 4: texpkb h1.w(TRUE), v5.xwxx, #0
+ 6: addh h0.x(TRUE), h1.w, -h2.y
+ 7: texpkb h2.w(TRUE), v5.zwzz, #0
+ 9: minh h4.w(TRUE), h2.y, h2
+ 10: maxh h5.x(TRUE), h2.y, h2.w
+ 11: texpkb h0.w(TRUE), v5, #0
+ 13: addh h3.w(TRUE), -h0, h0.x
+ 14: addh h0.x(TRUE), h0.w, h0
+ 15: addh h0.z(TRUE), -h2.w, h0.x
+ 16: addh h0.x(TRUE), h2.w, h3.w
+ 17: minh h5.y(TRUE), h0.w, h1.w
+ 18: nrmh h2.xz(TRUE), h0_n
+ 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z|
+ 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w
+ 21: movr r1.zw(TRUE), v4.xxxy
+ 22: maxh h2.w(TRUE), h0, h1
+ 23: fenct TRUE
+ 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 26: texpkb h0(TRUE), r0, #0
+ 28: maxh h5.x(TRUE), h2.w, h5
+ 29: minh h5.w(TRUE), h5.y, h4
+ 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz
+ 32: texpkb h2(TRUE), r1, #0
+ 34: addh_d2 h2(TRUE), h0, h2
+ 35: texpkb h1(TRUE), v4, #0
+ 37: maxh h5.y(TRUE), h5.x, h1.w
+ 38: minh h4.w(TRUE), h1, h5
+ 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 41: texpkb h0(TRUE), r0, #0
+ 43: addh_m8 h5.z(TRUE), h5.y, -h4.w
+ 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz
+ 46: texpkb h3(TRUE), r2, #0
+ 48: addh_d2 h0(TRUE), h0, h3
+ 49: addh_d2 h3(TRUE), h0, h2
+ 50: movh h0(TRUE), h3
+ 51: slth h3.x(TRUE), h3.w, h5.w
+ 52: sgth h3.w(TRUE), h3, h5.x
+ 53: addx.c0 rc(TRUE), h3.x, h3
+ 54: slth.c0 rc(TRUE), h5.z, h5
+ 55: movh h0(c0.NE.w), h2
+ 56: movh h0(c0.NE.x), h1
+
+IPU0 ------ Simplified schedule: --------
+Pass | Unit | uOp | PC: Op
+-----+--------+------+-------------------------
+ 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0;
+ | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--;
+ | | |
+ 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0;
+ | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---;
+ | | |
+ 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0;
+ | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---;
+ | SCB1 | min | 9: MINh h4.w, h2.---y, h2;
+ | | |
+ 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0;
+ | SCB0 | add | 14: ADDh h0.x, h0.w---, h0;
+ | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x;
+ | | |
+ 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---;
+ | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-;
+ | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--;
+ | | |
+ 6 | SCT1 | mov | 18: NRMh h2.xz, h0;
+ | SRB | nrm | 18: NRMh h2.xz, h0;
+ | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|;
+ | | |
+ 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--;
+ | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy;
+ | SCB1 | max | 22: MAXh h2.w, h0, h1;
+ | | |
+ 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0;
+ | SCB0 | max | 28: MAXh h5.x, h2.w---, h5;
+ | SCB1 | min | 29: MINh h5.w, h5.---y, h4;
+ | | |
+ 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--;
+ | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0;
+ | SCB0/1 | add | 34: ADDh/2 h2, h0, h2;
+ | | |
+ 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0;
+ | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--;
+ | SCB1 | min | 38: MINh h4.w, h1, h5;
+ | | |
+ 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--;
+ | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0;
+ | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--;
+ | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-;
+ | | |
+ 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0;
+ | SCB0/1 | add | 48: ADDh/2 h0, h0, h3;
+ | | |
+ 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2;
+ | SCB0/1 | mul | 50: MOVh h0, h3;
+ | | |
+ 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---;
+ | SCT1 | set | 52: SGTh h3.w, h3, h5.---x;
+ | SCB0 | set | 54: SLThc0 rc, h5.z---, h5;
+ | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3;
+ | | |
+ 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2;
+ | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1;
+
+Pass SCT TEX SCB
+ 1: 0% 100% 25%
+ 2: 0% 100% 25%
+ 3: 0% 100% 50%
+ 4: 0% 100% 50%
+ 5: 50% 0% 25%
+ 6: 0% 0% 25%
+ 7: 100% 0% 25%
+ 8: 0% 100% 50%
+ 9: 0% 100% 100%
+ 10: 0% 100% 50%
+ 11: 0% 100% 75%
+ 12: 0% 100% 100%
+ 13: 100% 0% 100%
+ 14: 50% 0% 50%
+ 15: 100% 0% 100%
+
+MEAN: 26% 60% 56%
+
+Pass SCT0 SCT1 TEX SCB0 SCB1
+ 1: 0% 0% 100% 100% 0%
+ 2: 0% 0% 100% 100% 0%
+ 3: 0% 0% 100% 100% 100%
+ 4: 0% 0% 100% 100% 100%
+ 5: 100% 100% 0% 100% 0%
+ 6: 0% 0% 0% 0% 100%
+ 7: 100% 100% 0% 0% 100%
+ 8: 0% 0% 100% 100% 100%
+ 9: 0% 0% 100% 100% 100%
+ 10: 0% 0% 100% 100% 100%
+ 11: 0% 0% 100% 100% 100%
+ 12: 0% 0% 100% 100% 100%
+ 13: 100% 100% 0% 100% 100%
+ 14: 100% 100% 0% 100% 100%
+ 15: 100% 100% 0% 100% 100%
+
+MEAN: 33% 33% 60% 86% 80%
+Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5
+Results 15 cycles, 3 r regs, 800,000,000 pixels/s
+============================================================================*/
+#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1)
+/*--------------------------------------------------------------------------*/
+#pragma regcount 7
+#pragma disablepc all
+#pragma option O2
+#pragma option OutColorPrec=fp16
+#pragma texformat default RGBA8
+/*==========================================================================*/
+half4 FxaaPixelShader(
+ // See FXAA Quality FxaaPixelShader() source for docs on Inputs!
+ FxaaFloat2 pos,
+ FxaaFloat4 fxaaConsolePosPos,
+ FxaaTex tex,
+ FxaaTex fxaaConsole360TexExpBiasNegOne,
+ FxaaTex fxaaConsole360TexExpBiasNegTwo,
+ FxaaFloat2 fxaaQualityRcpFrame,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt,
+ FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+ FxaaFloat4 fxaaConsole360RcpFrameOpt2,
+ FxaaFloat fxaaQualitySubpix,
+ FxaaFloat fxaaQualityEdgeThreshold,
+ FxaaFloat fxaaQualityEdgeThresholdMin,
+ FxaaFloat fxaaConsoleEdgeSharpness,
+ FxaaFloat fxaaConsoleEdgeThreshold,
+ FxaaFloat fxaaConsoleEdgeThresholdMin,
+ FxaaFloat4 fxaaConsole360ConstDir
+) {
+/*--------------------------------------------------------------------------*/
+// (1)
+ half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaNe = rgbyNe.w + half(1.0/512.0);
+ #else
+ half lumaNe = rgbyNe.y + half(1.0/512.0);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (2)
+ half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaSwNegNe = lumaSw.w - lumaNe;
+ #else
+ half lumaSwNegNe = lumaSw.y - lumaNe;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (3)
+ half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxNwSw = max(lumaNw.w, lumaSw.w);
+ half lumaMinNwSw = min(lumaNw.w, lumaSw.w);
+ #else
+ half lumaMaxNwSw = max(lumaNw.y, lumaSw.y);
+ half lumaMinNwSw = min(lumaNw.y, lumaSw.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (4)
+ half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half dirZ = lumaNw.w + lumaSwNegNe;
+ half dirX = -lumaNw.w + lumaSwNegNe;
+ #else
+ half dirZ = lumaNw.y + lumaSwNegNe;
+ half dirX = -lumaNw.y + lumaSwNegNe;
+ #endif
+/*--------------------------------------------------------------------------*/
+// (5)
+ half3 dir;
+ dir.y = 0.0;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ dir.x = lumaSe.w + dirX;
+ dir.z = -lumaSe.w + dirZ;
+ half lumaMinNeSe = min(lumaNe, lumaSe.w);
+ #else
+ dir.x = lumaSe.y + dirX;
+ dir.z = -lumaSe.y + dirZ;
+ half lumaMinNeSe = min(lumaNe, lumaSe.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (6)
+ half4 dir1_pos;
+ dir1_pos.xy = normalize(dir).xz;
+ half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS);
+/*--------------------------------------------------------------------------*/
+// (7)
+ half4 dir2_pos;
+ dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0));
+ dir1_pos.zw = pos.xy;
+ dir2_pos.zw = pos.xy;
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxNeSe = max(lumaNe, lumaSe.w);
+ #else
+ half lumaMaxNeSe = max(lumaNe, lumaSe.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (8)
+ half4 temp1N;
+ temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+ temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0));
+ half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe);
+ half lumaMin = min(lumaMinNwSw, lumaMinNeSe);
+/*--------------------------------------------------------------------------*/
+// (9)
+ half4 rgby1;
+ rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw;
+ rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0));
+ rgby1 = (temp1N + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (10)
+ half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0));
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ half lumaMaxM = max(lumaMax, rgbyM.w);
+ half lumaMinM = min(lumaMin, rgbyM.w);
+ #else
+ half lumaMaxM = max(lumaMax, rgbyM.y);
+ half lumaMinM = min(lumaMin, rgbyM.y);
+ #endif
+/*--------------------------------------------------------------------------*/
+// (11)
+ half4 temp2N;
+ temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0));
+ half4 rgby2;
+ rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw;
+ half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD;
+/*--------------------------------------------------------------------------*/
+// (12)
+ rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0));
+ rgby2 = (temp2N + rgby2) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (13)
+ rgby2 = (rgby2 + rgby1) * 0.5;
+/*--------------------------------------------------------------------------*/
+// (14)
+ #if (FXAA_GREEN_AS_LUMA == 0)
+ bool twoTapLt = rgby2.w < lumaMin;
+ bool twoTapGt = rgby2.w > lumaMax;
+ #else
+ bool twoTapLt = rgby2.y < lumaMin;
+ bool twoTapGt = rgby2.y > lumaMax;
+ #endif
+ bool earlyExit = lumaRangeM < lumaMax;
+ bool twoTap = twoTapLt || twoTapGt;
+/*--------------------------------------------------------------------------*/
+// (15)
+ if(twoTap) rgby2 = rgby1;
+ if(earlyExit) rgby2 = rgbyM;
+/*--------------------------------------------------------------------------*/
+ return rgby2; }
+/*==========================================================================*/
+#endif
+
+uniform sampler2D diffuseMap;
+
+uniform vec2 rcp_screen_res;
+uniform vec4 rcp_frame_opt;
+uniform vec4 rcp_frame_opt2;
uniform vec2 screen_res;
varying vec2 vary_fragcoord;
+varying vec2 vary_tc;
void main()
{
- vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
+ vec4 diff = FxaaPixelShader(vary_tc, //pos
+ vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
+ diffuseMap, //tex
+ diffuseMap,
+ diffuseMap,
+ rcp_screen_res, //fxaaQualityRcpFrame
+ vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt
+ rcp_frame_opt, //fxaaConsoleRcpFrameOpt2
+ rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2
+ 0.75, //fxaaQualitySubpix
+ 0.166, //fxaaQualityEdgeThreshold
+ 0.0833, //fxaaQualityEdgeThresholdMin
+ 8.0, //fxaaConsoleEdgeSharpness
+ 0.125, //fxaaConsoleEdgeThreshold
+ 0.05, //fxaaConsoleEdgeThresholdMin
+ vec4(0,0,0,0)); //fxaaConsole360ConstDir
+
+
+
+ //diff = texture2D(diffuseMap, vary_tc);
+
+ gl_FragColor = diff;
- vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
- gl_FragColor = diff + bloom;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl
index 41849858e7..b519dbc4b0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl
@@ -1,5 +1,5 @@
/**
- * @file postDeferredF.glsl
+ * @file postDeferredNoDoFF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -23,33 +23,19 @@
* $/LicenseInfo$
*/
-
-
#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-uniform sampler2DMS diffuseRect;
+uniform sampler2DRect diffuseRect;
uniform sampler2D bloomMap;
uniform vec2 screen_res;
varying vec2 vary_fragcoord;
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
-{
- vec4 ret = vec4(0,0,0,0);
-
- for (int i = 0; i < samples; ++i)
- {
- ret += texelFetch(tex,tc,i);
- }
-
- return ret/samples;
-}
-
void main()
{
- vec4 diff = texture2DMS(diffuseRect, ivec2(vary_fragcoord.xy));
-
+ vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
+
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
gl_FragColor = diff + bloom;
}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl
index 792102a64d..861bb9f735 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl
@@ -22,16 +22,13 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-
#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS edgeMap;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
+uniform sampler2DRect diffuseRect;
+uniform sampler2DRect edgeMap;
+uniform sampler2DRect depthMap;
+uniform sampler2DRect normalMap;
uniform sampler2D bloomMap;
uniform float depth_cutoff;
@@ -46,20 +43,9 @@ uniform vec2 screen_res;
varying vec2 vary_fragcoord;
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
-{
- vec4 ret = vec4(0,0,0,0);
- for (int i = 0; i < samples; ++i)
- {
- ret += texelFetch(tex, tc, i);
- }
-
- return ret/samples;
-}
-
-float getDepth(ivec2 pos_screen)
+float getDepth(vec2 pos_screen)
{
- float z = texture2DMS(depthMap, pos_screen.xy).r;
+ float z = texture2DRect(depthMap, pos_screen.xy).r;
z = z*2.0-1.0;
vec4 ndc = vec4(0.0, 0.0, z, 1.0);
vec4 p = inv_proj*ndc;
@@ -81,7 +67,24 @@ float calc_cof(float depth)
return sc;
}
-void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ivec2 tc)
+void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc)
+{
+ float d = getDepth(tc);
+
+ float sc = calc_cof(d);
+
+ float wg = 0.25;
+
+ vec4 s = texture2DRect(diffuseRect, tc);
+ // de-weight dull areas to make highlights 'pop'
+ wg += s.r+s.g+s.b;
+
+ diff += wg*s;
+
+ w += wg;
+}
+
+void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, vec2 tc)
{
float d = getDepth(tc);
@@ -92,7 +95,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, iv
{
float wg = 0.25;
- vec4 s = texture2DMS(diffuseRect, tc);
+ vec4 s = texture2DRect(diffuseRect, tc);
// de-weight dull areas to make highlights 'pop'
wg += s.r+s.g+s.b;
@@ -105,14 +108,14 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, iv
void main()
{
- ivec2 itc = ivec2(vary_fragcoord.xy);
-
- vec3 norm = texture2DMS(normalMap, itc).xyz;
+ vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- float depth = getDepth(itc);
+ vec2 tc = vary_fragcoord.xy;
- vec4 diff = texture2DMS(diffuseRect, itc);
+ float depth = getDepth(tc);
+
+ vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
{
float w = 1.0;
@@ -124,22 +127,21 @@ void main()
float PI = 3.14159265358979323846264;
- int isc = int(sc);
-
// sample quite uniformly spaced points within a circle, for a circular 'bokeh'
//if (depth < focal_distance)
{
- for (int x = -isc; x <= isc; x+=2)
+ while (sc > 0.5)
{
- for (int y = -isc; y <= isc; y+=2)
+ int its = int(max(1.0,(sc*3.7)));
+ for (int i=0; i<its; ++i)
{
- ivec2 cur_samp = ivec2(x,y);
- float cur_sc = length(vec2(cur_samp));
- if (cur_sc < sc)
- {
- dofSample(diff, w, cur_sc, depth, itc+cur_samp);
- }
+ float ang = sc+i*2*PI/its; // sc is added for rotary perturbance
+ float samp_x = sc*sin(ang);
+ float samp_y = sc*cos(ang);
+ // you could test sample coords against an interesting non-circular aperture shape here, if desired.
+ dofSample(diff, w, sc, depth, vary_fragcoord.xy + vec2(samp_x,samp_y));
}
+ sc -= 1.0;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index cb83dda795..b11f26fbae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -22,16 +22,23 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
+varying vec2 vary_tc;
+
+uniform vec2 tc_scale;
+
uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+ vary_tc = (pos.xy*0.5+0.5)*tc_scale;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
index 6231ee68b7..61c6393648 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
index 4be18a9c5e..f7bed00214 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -22,20 +22,25 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+ vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
post_pos = pos;
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index fc3ff45614..190cac9e2c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -22,15 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec4 post_pos;
void main()
{
//transform vertex
- vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex;
+ vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
post_pos = pos;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index 3a44bb6d26..e97d3e0828 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -57,12 +60,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+ //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 855d89ebe6..8116b7cdbf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -63,7 +63,7 @@ uniform vec3 env_mat[3];
//uniform vec4 shadow_clip;
uniform mat3 ssao_effect_mat;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
varying vec2 vary_fragcoord;
vec3 vary_PositionEye;
@@ -283,7 +283,7 @@ void main()
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+ float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -304,7 +304,7 @@ void main()
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
+ float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
// add the two types of shiny together
@@ -324,5 +324,6 @@ void main()
}
gl_FragColor.rgb = col;
+
gl_FragColor.a = bloom;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl
deleted file mode 100644
index f118b0da2a..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightMSF.glsl
+++ /dev/null
@@ -1,342 +0,0 @@
-/**
- * @file softenLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS normalMap;
-uniform sampler2DMS depthMap;
-uniform sampler2D noiseMap;
-uniform samplerCube environmentMap;
-uniform sampler2D lightFunc;
-
-uniform float blur_size;
-uniform float blur_fidelity;
-
-// Inputs
-uniform vec4 morphFactor;
-uniform vec3 camPosLocal;
-//uniform vec4 camPosWorld;
-uniform vec4 gamma;
-uniform vec4 lightnorm;
-uniform vec4 sunlight_color;
-uniform vec4 ambient;
-uniform vec4 blue_horizon;
-uniform vec4 blue_density;
-uniform vec4 haze_horizon;
-uniform vec4 haze_density;
-uniform vec4 cloud_shadow;
-uniform vec4 density_multiplier;
-uniform vec4 distance_multiplier;
-uniform vec4 max_y;
-uniform vec4 glow;
-uniform float scene_light_strength;
-uniform vec3 env_mat[3];
-//uniform mat4 shadow_matrix[3];
-//uniform vec4 shadow_clip;
-uniform mat3 ssao_effect_mat;
-
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
-
-vec3 vary_PositionEye;
-
-vec3 vary_SunlitColor;
-vec3 vary_AmblitColor;
-vec3 vary_AdditiveColor;
-vec3 vary_AtmosAttenuation;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
- vec2 sc = pos_screen.xy*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-vec3 getPositionEye()
-{
- return vary_PositionEye;
-}
-vec3 getSunlitColor()
-{
- return vary_SunlitColor;
-}
-vec3 getAmblitColor()
-{
- return vary_AmblitColor;
-}
-vec3 getAdditiveColor()
-{
- return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
- return vary_AtmosAttenuation;
-}
-
-
-void setPositionEye(vec3 v)
-{
- vary_PositionEye = v;
-}
-
-void setSunlitColor(vec3 v)
-{
- vary_SunlitColor = v;
-}
-
-void setAmblitColor(vec3 v)
-{
- vary_AmblitColor = v;
-}
-
-void setAdditiveColor(vec3 v)
-{
- vary_AdditiveColor = v;
-}
-
-void setAtmosAttenuation(vec3 v)
-{
- vary_AtmosAttenuation = v;
-}
-
-void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
-
- vec3 P = inPositionEye;
- setPositionEye(P);
-
- //(TERRAIN) limit altitude
- if (P.y > max_y.x) P *= (max_y.x / P.y);
- if (P.y < -max_y.x) P *= (-max_y.x / P.y);
-
- vec3 tmpLightnorm = lightnorm.xyz;
-
- vec3 Pn = normalize(P);
- float Plen = length(P);
-
- vec4 temp1 = vec4(0);
- vec3 temp2 = vec3(0);
- vec4 blue_weight;
- vec4 haze_weight;
- vec4 sunlight = sunlight_color;
- vec4 light_atten;
-
- //sunlight attenuation effect (hue and brightness) due to atmosphere
- //this is used later for sunlight modulation at various altitudes
- light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x);
- //I had thought blue_density and haze_density should have equal weighting,
- //but attenuation due to haze_density tends to seem too strong
-
- temp1 = blue_density + vec4(haze_density.r);
- blue_weight = blue_density / temp1;
- haze_weight = vec4(haze_density.r) / temp1;
-
- //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain)
- temp2.y = max(0.0, tmpLightnorm.y);
- temp2.y = 1. / temp2.y;
- sunlight *= exp( - light_atten * temp2.y);
-
- // main atmospheric scattering line integral
- temp2.z = Plen * density_multiplier.x;
-
- // Transparency (-> temp1)
- // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati
- // compiler gets confused.
- temp1 = exp(-temp1 * temp2.z * distance_multiplier.x);
-
- //final atmosphere attenuation factor
- setAtmosAttenuation(temp1.rgb);
-
- //compute haze glow
- //(can use temp2.x as temp because we haven't used it yet)
- temp2.x = dot(Pn, tmpLightnorm.xyz);
- temp2.x = 1. - temp2.x;
- //temp2.x is 0 at the sun and increases away from sun
- temp2.x = max(temp2.x, .03); //was glow.y
- //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)
- temp2.x *= glow.x;
- //higher glow.x gives dimmer glow (because next step is 1 / "angle")
- temp2.x = pow(temp2.x, glow.z);
- //glow.z should be negative, so we're doing a sort of (1 / "angle") function
-
- //add "minimum anti-solar illumination"
- temp2.x += .25;
-
- //increase ambient when there are more clouds
- vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
-
- /* decrease value and saturation (that in HSV, not HSL) for occluded areas
- * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
- * // The following line of code performs the equivalent of:
- * float ambAlpha = tmpAmbient.a;
- * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
- * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
- * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
- */
- tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
-
- //haze color
- setAdditiveColor(
- vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient)
- + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x
- + tmpAmbient)));
-
- //brightness of surface both sunlight and ambient
- setSunlitColor(vec3(sunlight * .5));
- setAmblitColor(vec3(tmpAmbient * .25));
- setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
-}
-
-vec3 atmosLighting(vec3 light)
-{
- light *= getAtmosAttenuation().r;
- light += getAdditiveColor();
- return (2.0 * light);
-}
-
-vec3 atmosTransport(vec3 light) {
- light *= getAtmosAttenuation().r;
- light += getAdditiveColor() * 2.0;
- return light;
-}
-vec3 atmosGetDiffuseSunlightColor()
-{
- return getSunlitColor();
-}
-
-vec3 scaleDownLight(vec3 light)
-{
- return (light / scene_light_strength );
-}
-
-vec3 scaleUpLight(vec3 light)
-{
- return (light * scene_light_strength);
-}
-
-vec3 atmosAmbient(vec3 light)
-{
- return getAmblitColor() + light / 2.0;
-}
-
-vec3 atmosAffectDirectionalLight(float lightIntensity)
-{
- return getSunlitColor() * lightIntensity;
-}
-
-vec3 scaleSoftClip(vec3 light)
-{
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
-
- return light;
-}
-
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
-{
- vec4 ret = vec4(0,0,0,0);
-
- for (int i = 0; i < samples; ++i)
- {
- ret += texelFetch(tex,tc,i);
- }
-
- return ret/samples;
-}
-
-void main()
-{
- vec2 tc = vary_fragcoord.xy;
- ivec2 itc = ivec2(tc);
-
- vec4 fcol = vec4(0,0,0,0);
-
- for (int i = 0; i < samples; ++i)
- {
- float depth = texelFetch(depthMap, itc, i).r;
- vec3 pos = getPosition_d(tc, depth).xyz;
- vec3 norm = texelFetch(normalMap, itc, i).xyz;
-
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
-
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
-
- vec4 diffuse = texelFetch(diffuseRect, itc, i);
- vec3 col;
- float bloom = 0.0;
-
- if (diffuse.a < 0.9)
- {
- vec4 spec = texelFetch(specularRect, itc, i);
-
- calcAtmospherics(pos.xyz, 1.0);
-
- col = atmosAmbient(vec3(0));
- col += atmosAffectDirectionalLight(max(min(da, 1.0), diffuse.a));
-
- col *= diffuse.rgb;
-
- if (spec.a > 0.0) // specular reflection
- {
- // the old infinite-sky shiny reflection
- //
- vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
- vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
-
- // add the two types of shiny together
- vec3 spec_contrib = dumbshiny * spec.rgb;
- bloom = dot(spec_contrib, spec_contrib);
- col += spec_contrib;
- }
-
- col = atmosLighting(col);
- col = scaleSoftClip(col);
- col = mix(col, diffuse.rgb, diffuse.a);
- }
- else
- {
- col = diffuse.rgb;
- }
-
- fcol += vec4(col, bloom);
- }
-
- gl_FragColor = fcol/samples;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
index fed238510a..7d1e99b4aa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
@@ -23,22 +23,18 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
uniform vec2 screen_res;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- gl_Position = ftransform();
-
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
+ vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index 7363bd6715..e69fa074c4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -31,7 +31,6 @@ uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
-uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
@@ -50,7 +49,10 @@ uniform float far_clip;
uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
uniform float sun_wash;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform vec3 color;
+uniform float falloff;
+uniform float size;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -78,9 +80,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -100,7 +102,7 @@ void main()
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
lv = proj_origin-pos.xyz;
@@ -126,7 +128,7 @@ void main()
vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -145,7 +147,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -174,7 +176,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
deleted file mode 100644
index 0c0171881f..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * @file multiSpotLightF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-//class 1 -- no shadows
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-uniform sampler2DMS diffuseRect;
-uniform sampler2DMS specularRect;
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-uniform sampler2D lightFunc;
-uniform sampler2D projectionMap;
-
-uniform mat4 proj_mat; //screen space to light space
-uniform float proj_near; //near clip for projection
-uniform vec3 proj_p; //plane projection is emitting from (in screen space)
-uniform vec3 proj_n;
-uniform float proj_focus; //distance from plane to begin blurring
-uniform float proj_lod; //(number of mips in proj map)
-uniform float proj_range; //range between near clip and far clip plane of projection
-uniform float proj_ambient_lod;
-uniform float proj_ambiance;
-uniform float near_clip;
-uniform float far_clip;
-
-uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
-uniform float sun_wash;
-uniform int proj_shadow_idx;
-uniform float shadow_fade;
-
-varying vec4 vary_light;
-
-varying vec4 vary_fragcoord;
-uniform vec2 screen_res;
-
-uniform mat4 inv_proj;
-
-vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = tc-vec2(0.5);
-
- float det = max(1.0-lod/(proj_lod*0.5), 0.0);
-
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
-
- return ret;
-}
-
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-
- float det = min(lod/(proj_lod*0.5), 1.0);
-
- float d = min(dist.x, dist.y);
-
- float edge = 0.25*det;
-
- ret *= clamp(d/edge, 0.0, 1.0);
-
- return ret;
-}
-
-vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
-
- vec2 dist = tc-vec2(0.5);
-
- float d = dot(dist,dist);
-
- ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
-
- return ret;
-}
-
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
- float depth = texelFetch(depthMap, pos_screen, sample).r;
- vec2 sc = vec2(pos_screen.xy)*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-void main()
-{
- vec4 frag = vary_fragcoord;
- frag.xyz /= frag.w;
- frag.xyz = frag.xyz*0.5+0.5;
- frag.xy *= screen_res;
- ivec2 itc = ivec2(frag.xy);
-
- vec3 fcol = vec3(0,0,0);
- int wght = 0;
-
- for (int i = 0; i < samples; ++i)
- {
- vec3 pos = getPosition(itc, i).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
- float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
- if (dist2 <= 1.0)
- {
- vec3 norm = texelFetch(normalMap, itc, i).xyz*2.0-1.0;
-
- norm = normalize(norm);
- float l_dist = -dot(lv, proj_n);
-
- vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0));
- if (proj_tc.z >= 0.0)
- {
- proj_tc.xyz /= proj_tc.w;
-
- float fa = gl_Color.a+1.0;
- float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
- if (dist_atten > 0.0)
- {
- lv = proj_origin-pos.xyz;
- lv = normalize(lv);
- float da = dot(norm, lv);
-
- vec3 col = vec3(0,0,0);
-
- vec3 diff_tex = texelFetch(diffuseRect, itc, i).rgb;
-
- float noise = texture2D(noiseMap, frag.xy/128.0).b;
- if (proj_tc.z > 0.0 &&
- proj_tc.x < 1.0 &&
- proj_tc.y < 1.0 &&
- proj_tc.x > 0.0 &&
- proj_tc.y > 0.0)
- {
- float lit = 0.0;
- float amb_da = proj_ambiance;
-
- if (da > 0.0)
- {
- float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
- float lod = diff * proj_lod;
-
- vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
-
- lit = da * dist_atten * noise;
-
- col = lcol*lit*diff_tex;
- amb_da += (da*0.5)*proj_ambiance;
- }
-
- //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
- vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
-
- amb_da += (da*da*0.5+0.5)*proj_ambiance;
-
- amb_da *= dist_atten * noise;
-
- amb_da = min(amb_da, 1.0-lit);
-
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
- }
-
-
- vec4 spec = texelFetch(specularRect, itc, i);
- if (spec.a > 0.0)
- {
- vec3 ref = reflect(normalize(pos), norm);
-
- //project from point pos in direction ref to plane proj_p, proj_n
- vec3 pdelta = proj_p-pos;
- float ds = dot(ref, proj_n);
-
- if (ds < 0.0)
- {
- vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
-
- vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
- if (stc.z > 0.0)
- {
- stc.xy /= stc.w;
-
- float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
-
- stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
-
- if (stc.x < 1.0 &&
- stc.y < 1.0 &&
- stc.x > 0.0 &&
- stc.y > 0.0)
- {
- vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
- }
- }
- }
- }
-
- fcol += col;
- ++wght;
- }
- }
- }
- }
-
- if (wght <= 0)
- {
- discard;
- }
-
- gl_FragColor.rgb = fcol/samples;
- gl_FragColor.a = 0.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index 84adf6bc41..1fcb05ef2c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -22,14 +22,18 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 2f880d65dd..4a69192fc3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -42,7 +42,6 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
uniform mat4 inv_proj;
uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl
deleted file mode 100644
index abb64334ed..0000000000
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOMSF.glsl
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * @file sunLightSSAOF.glsl
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-#extension GL_ARB_texture_rectangle : enable
-#extension GL_ARB_texture_multisample : enable
-
-//class 1 -- no shadow, SSAO only
-
-uniform sampler2DMS depthMap;
-uniform sampler2DMS normalMap;
-uniform sampler2D noiseMap;
-
-
-// Inputs
-uniform mat4 shadow_matrix[6];
-uniform vec4 shadow_clip;
-uniform float ssao_radius;
-uniform float ssao_max_radius;
-uniform float ssao_factor;
-uniform float ssao_factor_inv;
-
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
-
-uniform mat4 inv_proj;
-uniform vec2 screen_res;
-
-uniform float shadow_bias;
-uniform float shadow_offset;
-
-vec4 getPosition(ivec2 pos_screen, int sample)
-{
- float depth = texelFetch(depthMap, pos_screen, sample).r;
- vec2 sc = pos_screen.xy*2.0;
- sc /= screen_res;
- sc -= vec2(1.0,1.0);
- vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
- vec4 pos = inv_proj * ndc;
- pos /= pos.w;
- pos.w = 1.0;
- return pos;
-}
-
-//calculate decreases in ambient lighting when crowded out (SSAO)
-float calcAmbientOcclusion(vec4 pos, vec3 norm, int sample)
-{
- float ret = 1.0;
-
- vec2 kern[8];
- // exponentially (^2) distant occlusion samples spread around origin
- kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
- kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
- kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
- kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
- kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
- kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
- kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
- kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
-
- vec2 pos_screen = vary_fragcoord.xy;
- vec3 pos_world = pos.xyz;
- vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
-
- float angle_hidden = 0.0;
- int points = 0;
-
- float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
-
- // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?)
- for (int i = 0; i < 8; i++)
- {
- ivec2 samppos_screen = ivec2(pos_screen + scale * reflect(kern[i], noise_reflect));
- vec3 samppos_world = getPosition(samppos_screen, sample).xyz;
-
- vec3 diff = pos_world - samppos_world;
- float dist2 = dot(diff, diff);
-
- // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
- // --> solid angle shrinking by the square of distance
- //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
- //(k should vary inversely with # of samples, but this is taken care of later)
-
- angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
-
- // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
- points = points + int(diff.z > -1.0);
- }
-
- angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
-
- ret = (1.0 - (float(points != 0) * angle_hidden));
-
- return min(ret, 1.0);
-}
-
-void main()
-{
- vec2 pos_screen = vary_fragcoord.xy;
- ivec2 itc = ivec2(pos_screen);
-
- float col = 0;
-
- for (int i = 0; i < samples; i++)
- {
- vec4 pos = getPosition(itc, i);
- vec3 norm = texelFetch(normalMap, itc, i).xyz;
- norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
- col += calcAmbientOcclusion(pos,norm,i);
- }
-
- col /= samples;
-
- gl_FragColor[0] = 1.0;
- gl_FragColor[1] = col;
- gl_FragColor[2] = 1.0;
- gl_FragColor[3] = 1.0;
-}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
index e7ab11c6ed..10751304ae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
@@ -22,10 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -33,13 +34,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_light = gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index fc19a73709..7f84ef1cff 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
varying vec3 vary_normal;
@@ -44,14 +52,14 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(normal_matrix * normal);
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
- vec4 t = gl_MultiTexCoord1;
+ vec4 t = vec4(texcoord1,0,1);
gl_TexCoord[0].zw = t.xy;
gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index 56a149523e..a6406bdc12 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -29,10 +29,18 @@ uniform sampler2D diffuseMap;
varying vec3 vary_normal;
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
void main()
{
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
- gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
+ if (col.a < minimum_alpha || col.a > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, 0.0);
gl_FragData[1] = vec4(0,0,0,0);
vec3 nvn = normalize(vary_normal);
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
new file mode 100644
index 0000000000..9f0b902c96
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
@@ -0,0 +1,27 @@
+/**
+ * @file treeShadowF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform float minimum_alpha;
+uniform float maximum_alpha;
+
+uniform sampler2D diffuseMap;
+
+varying vec4 post_pos;
+
+void main()
+{
+ float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a;
+
+ if (alpha < minimum_alpha || alpha > maximum_alpha)
+ {
+ discard;
+ }
+
+ gl_FragColor = vec4(1,1,1,1);
+
+ gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
new file mode 100644
index 0000000000..c695d374ac
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -0,0 +1,44 @@
+/**
+ * @file treeShadowV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+
+varying vec4 post_pos;
+
+void main()
+{
+ //transform vertex
+ vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ post_pos = pos;
+
+ gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
+
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index 01401028d6..45bfc0ce09 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -22,18 +22,24 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+uniform mat3 normal_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
varying vec3 vary_normal;
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vary_normal = normalize(gl_NormalMatrix * gl_Normal);
+ vary_normal = normalize(normal_matrix * normal);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = vec4(1,1,1,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
index 9d415ade85..ac51cb1741 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
@@ -22,7 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
void calcAtmospherics(vec3 inPositionEye);
@@ -47,43 +51,42 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- vec4 position = gl_Vertex;
- mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+ vec4 pos = vec4(position.xyz, 1.0);
+ mat4 modelViewProj = modelview_projection_matrix;
vec4 oPosition;
//get view vector
vec3 oEyeVec;
- oEyeVec.xyz = position.xyz-eyeVec;
+ oEyeVec.xyz = pos.xyz-eyeVec;
float d = length(oEyeVec.xy);
float ld = min(d, 2560.0);
- position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ pos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
view.xyz = oEyeVec;
d = clamp(ld/1536.0-0.5, 0.0, 1.0);
d *= d;
- oPosition = position;
+ oPosition = vec4(position, 1.0);
oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
- vary_position = gl_ModelViewMatrix * oPosition;
+ vary_position = modelview_matrix * oPosition;
oPosition = modelViewProj * oPosition;
refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
//get wave position parameter (create sweeping horizontal waves)
- vec3 v = position.xyz;
+ vec3 v = pos.xyz;
v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
//push position for further horizon effect.
- position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
- position.w = 1.0;
- position = position*gl_ModelViewMatrix;
-
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = modelview_matrix*pos;
+ calcAtmospherics(pos.xyz);
+
//pass wave parameters to pixel shader
vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055;
//get two normal map (detail map) texture coordinates
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index e827863436..c5ca9f4804 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -37,7 +37,6 @@ uniform float warmthAmount;
void main()
{
vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);
-
/// CALCULATING LUMINANCE (Using NTSC lum weights)
/// http://en.wikipedia.org/wiki/Luma_%28video%29
float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
@@ -45,4 +44,5 @@ void main()
gl_FragColor.rgb = col.rgb;
gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index 8db6d1bf24..628489296f 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -23,11 +23,15 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = modelview_projection_matrix * vec4(position, 1.0);
- gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
+ gl_TexCoord[0].xy = texcoord0;
}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
index a5aacc0196..615ca6a0b4 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -23,20 +23,23 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 glowDelta;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = modelview_projection_matrix * vec4(position, 1.0);
- gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5);
- gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5);
- gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5);
- gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5);
- gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5);
- gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5);
- gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5);
- gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5);
+ gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5);
+ gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5);
+ gl_TexCoord[2].xy = texcoord0 + glowDelta*(-1.5);
+ gl_TexCoord[3].xy = texcoord0 + glowDelta*(-0.5);
+ gl_TexCoord[0].zw = texcoord0 + glowDelta*(0.5);
+ gl_TexCoord[1].zw = texcoord0 + glowDelta*(1.5);
+ gl_TexCoord[2].zw = texcoord0 + glowDelta*(2.5);
+ gl_TexCoord[3].zw = texcoord0 + glowDelta*(3.5);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 917891c063..04b3033dd8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -22,7 +22,22 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 texture_matrix2;
+uniform mat4 texture_matrix3;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
+attribute vec2 texcoord2;
+attribute vec2 texcoord3;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -44,17 +59,17 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * gl_Vertex;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = modelview_matrix * position;
+ vec3 norm = normalize(normal_matrix * normal);
- vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color);
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color);
gl_FrontColor = color;
- gl_TexCoord[0] = texgen_object(gl_Vertex,gl_MultiTexCoord0,gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
- gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1;
- gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
- gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3;
+ gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
+ gl_TexCoord[1] = texture_matrix1*vec4(texcoord1,0,1);
+ gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
+ gl_TexCoord[3] = texture_matrix3*vec4(texcoord3,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 610c06fbbc..99433ada7b 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
void calcAtmospherics(vec3 inPositionEye);
@@ -45,8 +48,7 @@ float wave(vec2 v, float t, float f, vec2 d, float s)
void main()
{
//transform vertex
- vec4 position = gl_Vertex;
- mat4 modelViewProj = gl_ModelViewProjectionMatrix;
+ mat4 modelViewProj = modelview_projection_matrix;
vec4 oPosition;
@@ -57,27 +59,29 @@ void main()
float d = length(oEyeVec.xy);
float ld = min(d, 2560.0);
- position.xy = eyeVec.xy + oEyeVec.xy/d*ld;
+ vec3 lpos = position;
+ lpos.xy = eyeVec.xy + oEyeVec.xy/d*ld;
view.xyz = oEyeVec;
d = clamp(ld/1536.0-0.5, 0.0, 1.0);
d *= d;
- oPosition = position;
+ oPosition = vec4(lpos, 1.0);
oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d);
oPosition = modelViewProj * oPosition;
refCoord.xyz = oPosition.xyz + vec3(0,0,0.2);
//get wave position parameter (create sweeping horizontal waves)
- vec3 v = position.xyz;
+ vec3 v = lpos;
v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0;
//push position for further horizon effect.
- position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
- position.w = 1.0;
- position = position*gl_ModelViewMatrix;
+ vec4 pos;
+ pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);
+ pos.w = 1.0;
+ pos = modelview_matrix*pos;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
+ calcAtmospherics(pos.xyz);
//pass wave parameters to pixel shader
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
index c4c896c35c..5bbc7deff0 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
@@ -22,13 +22,18 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugF.glsl b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
new file mode 100644
index 0000000000..d43bf3fb50
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/debugF.glsl
@@ -0,0 +1,31 @@
+/**
+ * @file debugF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
new file mode 100644
index 0000000000..cd3d090e52
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
@@ -0,0 +1,34 @@
+/**
+ * @file debugV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+
+void main()
+{
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
new file mode 100644
index 0000000000..6639f88047
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -0,0 +1,23 @@
+/**
+ * @file glowcombineFXAAF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2D glowMap;
+uniform sampler2DRect screenMap;
+
+uniform vec2 screen_res;
+varying vec2 vary_tc;
+
+void main()
+{
+ vec3 col = texture2D(glowMap, vary_tc).rgb +
+ texture2DRect(screenMap, vary_tc*screen_res).rgb;
+
+
+ gl_FragColor = vec4(col.rgb, dot(col.rgb, vec3(0.299, 0.587, 0.144)));
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
new file mode 100644
index 0000000000..bd5dd6046b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
@@ -0,0 +1,39 @@
+/**
+ * @file glowcombineFXAAV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+
+varying vec2 vary_tc;
+
+void main()
+{
+ vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
+ vary_tc = pos.xy*0.5+0.5;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index 4c6360f71d..94edbe5ab1 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -22,12 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index a3cb5225ba..3a48205101 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -24,10 +24,10 @@
*/
-
+uniform vec4 color;
uniform sampler2D diffuseMap;
void main()
{
- gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+ gl_FragColor = color*texture2D(diffuseMap, gl_TexCoord[0].xy);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index da3bea6d06..6bb5affd93 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -22,24 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- pos = normalize(pos);
- float d = dot(pos, normalize(gl_NormalMatrix * gl_Normal));
- d *= d;
- d = 1.0 - d;
- d *= d;
-
- d = min(d, gl_Color.a*2.0);
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_FrontColor.rgb = gl_Color.rgb;
- gl_FrontColor.a = max(d, gl_Color.a);
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
index 915e452e0f..43dcd5dbe2 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -23,8 +23,12 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
new file mode 100644
index 0000000000..a5442c9bf4
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
@@ -0,0 +1,13 @@
+/**
+ * @file onetexturenocolorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+uniform sampler2D tex0;
+
+void main()
+{
+ gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy);
+}
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
new file mode 100644
index 0000000000..615412c7a2
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
@@ -0,0 +1,37 @@
+/**
+ * @file onetexturenocolorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+
+
+void main()
+{
+ gl_Position = modelview_projection_matrix * vec4(position, 1);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index fedf6ae546..45e6a9febc 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -22,13 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FrontColor = gl_Color;
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_FrontColor = diffuse_color;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
index 78ea15e87a..c263f4dc6a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
@@ -1,9 +1,9 @@
/**
- * @file sunLightF.glsl
+ * @file splattexturerectF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
+ * Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,13 +23,11 @@
* $/LicenseInfo$
*/
-
-
-//class 1, no shadow, no SSAO, should never be called
-
#extension GL_ARB_texture_rectangle : enable
+uniform sampler2DRect screenMap;
+
void main()
{
- gl_FragColor = vec4(0,0,0,0);
+ gl_FragColor = texture2DRect(screenMap, gl_TexCoord[0].xy) * gl_Color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
new file mode 100644
index 0000000000..2b471d99e8
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
@@ -0,0 +1,38 @@
+/**
+ * @file splattexturerectV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec4 diffuse_color;
+
+void main()
+{
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
index 94aa964be6..2a36feaa21 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
@@ -23,12 +23,16 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
index b1b90d0b5e..a9e42a432f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -22,13 +22,19 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void main()
{
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_FrontColor = gl_Color;
+ gl_Position = modelview_projection_matrix * vec4(position, 1);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index c50ed86315..dccc692593 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -22,13 +22,19 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
- gl_FrontColor = gl_Color;
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1 * vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
new file mode 100644
index 0000000000..e2a00e8440
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -0,0 +1,54 @@
+/**
+ * @file emissiveSkinnedV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+
+attribute vec3 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+mat4 getObjectSkinnedTransform();
+
+void main()
+{
+ //transform vertex
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ mat4 mat = getObjectSkinnedTransform();
+
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_Position = projection_matrix*vec4(pos, 1.0);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
new file mode 100644
index 0000000000..dedf00f374
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
@@ -0,0 +1,51 @@
+/**
+ * @file emissiveV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute float emissive;
+attribute vec2 texcoord0;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+varying float vary_texture_index;
+
+void main()
+{
+ //transform vertex
+ vary_texture_index = position.w;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(0,0,0,emissive);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
new file mode 100644
index 0000000000..b9c1078c30
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
@@ -0,0 +1,49 @@
+/**
+ * @file fullbrightNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ calcAtmospherics(pos.xyz);
+
+ gl_FrontColor = vec4(1,1,1,1);
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
index e1a7f263f7..546b7cad4a 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
@@ -22,7 +22,15 @@
* $/LicenseInfo$
*/
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
mat4 getObjectSkinnedTransform();
@@ -31,24 +39,24 @@ void main()
{
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
index 36b00dfbc1..a9b086e215 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -22,8 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -32,18 +41,18 @@ uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
index b540054c56..f0722a1e4d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
@@ -22,7 +22,13 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
mat4 getObjectSkinnedTransform();
@@ -30,23 +36,18 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
- norm.xyz = (mat*norm).xyz;
- norm.xyz = normalize(norm.xyz-pos.xyz);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
index 22f731ffde..d8f223d403 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -22,22 +22,29 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
+
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
index 92c09ce937..d09db8e6a3 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
@@ -26,14 +26,11 @@
uniform float minimum_alpha;
uniform float maximum_alpha;
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
uniform sampler2D diffuseMap;
void main()
{
- vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+ vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
if (color.a < minimum_alpha || color.a > maximum_alpha)
{
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
index eea51eba45..69007610c6 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -22,13 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
new file mode 100644
index 0000000000..3771c2e795
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -0,0 +1,53 @@
+/**
+ * @file previewV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
index f5fd4ededd..7e5c8ca2d5 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
@@ -22,7 +22,15 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -32,23 +40,23 @@ void main()
{
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
vec3 ref = reflect(pos.xyz, -norm.xyz);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
index 13a58f0d4a..da47f8a58a 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
void calcAtmospherics(vec3 inPositionEye);
@@ -32,18 +40,18 @@ uniform vec4 origin;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0*vec4(ref,1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
new file mode 100644
index 0000000000..d1d8126cb4
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -0,0 +1,53 @@
+/**
+ * @file simpleNoColorV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
index ad171f7b43..bf083a55c4 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
@@ -22,7 +22,14 @@
* $/LicenseInfo$
*/
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 projection_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -31,24 +38,24 @@ mat4 getObjectSkinnedTransform();
void main()
{
//transform vertex
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ mat = modelview_matrix * mat;
+ vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
- vec4 norm = gl_Vertex;
- norm.xyz += gl_Normal.xyz;
+ vec4 norm = vec4(position.xyz, 1.0);
+ norm.xyz += normal.xyz;
norm.xyz = (mat*norm).xyz;
norm.xyz = normalize(norm.xyz-pos.xyz);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
+ gl_Position = projection_matrix*vec4(pos, 1.0);
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index dc1794e132..87ece3972e 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -31,16 +39,15 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
- vec4 pos = (gl_ModelViewMatrix * gl_Vertex);
-
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
new file mode 100644
index 0000000000..64ca63731b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
@@ -0,0 +1,56 @@
+/**
+ * @file treeV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+
+ gl_Position = modelview_projection_matrix*vert;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+
+ vec4 pos = (modelview_matrix * vert);
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index f9f376c2b7..43e19909d4 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -31,17 +39,17 @@ void calcAtmospherics(vec3 inPositionEye);
void main()
{
//transform vertex
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
-
- vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
// vec4 specular = specularColor;
vec4 specular = vec4(1.0);
- vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
+ vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
new file mode 100644
index 0000000000..294a000ab5
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -0,0 +1,121 @@
+/**
+ * @file alphaNonIndexedNoColorF.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $/LicenseInfo$
+ */
+
+
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRectShadow shadowMap0;
+uniform sampler2DRectShadow shadowMap1;
+uniform sampler2DRectShadow shadowMap2;
+uniform sampler2DRectShadow shadowMap3;
+uniform sampler2DRect depthMap;
+uniform sampler2D diffuseMap;
+
+uniform mat4 shadow_matrix[6];
+uniform vec4 shadow_clip;
+uniform vec2 screen_res;
+uniform vec2 shadow_res;
+
+vec3 atmosLighting(vec3 light);
+vec3 scaleSoftClip(vec3 light);
+
+varying vec3 vary_ambient;
+varying vec3 vary_directional;
+varying vec3 vary_fragcoord;
+varying vec3 vary_position;
+varying vec3 vary_pointlight_col;
+
+uniform float shadow_bias;
+
+uniform mat4 inv_proj;
+
+vec4 getPosition(vec2 pos_screen)
+{
+ float depth = texture2DRect(depthMap, pos_screen.xy).a;
+ vec2 sc = pos_screen.xy*2.0;
+ sc /= screen_res;
+ sc -= vec2(1.0,1.0);
+ vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
+ vec4 pos = inv_proj * ndc;
+ pos.xyz /= pos.w;
+ pos.w = 1.0;
+ return pos;
+}
+
+float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
+{
+ stc.xyz /= stc.w;
+ stc.z += shadow_bias;
+
+ float cs = shadow2DRect(shadowMap, stc.xyz).x;
+ float shadow = cs;
+
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(scl, -scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, scl, 0.0)).x, cs);
+ shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-scl, -scl, 0.0)).x, cs);
+
+ return shadow/5.0;
+}
+
+
+void main()
+{
+ vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
+ frag *= screen_res;
+
+ float shadow = 1.0;
+ vec4 pos = vec4(vary_position, 1.0);
+
+ vec4 spos = pos;
+
+ if (spos.z > -shadow_clip.w)
+ {
+ vec4 lpos;
+
+ if (spos.z < -shadow_clip.z)
+ {
+ lpos = shadow_matrix[3]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap3, lpos, 1.5);
+ shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
+ }
+ else if (spos.z < -shadow_clip.y)
+ {
+ lpos = shadow_matrix[2]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap2, lpos, 1.5);
+ }
+ else if (spos.z < -shadow_clip.x)
+ {
+ lpos = shadow_matrix[1]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap1, lpos, 1.5);
+ }
+ else
+ {
+ lpos = shadow_matrix[0]*spos;
+ lpos.xy *= shadow_res;
+ shadow = pcfShadow(shadowMap0, lpos, 1.5);
+ }
+ }
+
+ vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
+
+ vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0);
+ vec4 color = diff * col;
+
+ color.rgb = atmosLighting(color.rgb);
+
+ color.rgb = scaleSoftClip(color.rgb);
+
+ color.rgb += diff.rgb * vary_pointlight_col.rgb;
+
+ gl_FragColor = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 20121da52d..df4d26997a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -21,8 +21,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -76,18 +84,18 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
mat4 mat = getObjectSkinnedTransform();
- mat = gl_ModelViewMatrix * mat;
+ mat = modelview_matrix * mat;
- vec3 pos = (mat*gl_Vertex).xyz;
+ vec3 pos = (mat*vec4(position, 1.0)).xyz;
- gl_Position = gl_ProjectionMatrix * vec4(pos, 1.0);
+ gl_Position = projection_matrix * vec4(pos, 1.0);
- vec4 n = gl_Vertex;
- n.xyz += gl_Normal.xyz;
+ vec4 n = vec4(position, 1.0);
+ n.xyz += normal.xyz;
n.xyz = (mat*n).xyz;
n.xyz = normalize(n.xyz-pos.xyz);
@@ -98,8 +106,8 @@ void main()
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -109,23 +117,23 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos.xyz = (gl_ModelViewProjectionMatrix * gl_Vertex).xyz;
+ pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 307ae30098..996203ffd6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -79,22 +87,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz, 1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix * vert;
-
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz, 1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+
+ vec3 norm = normalize(normal_matrix * normal);
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -104,23 +112,23 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb*diffuse_color.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb*diffuse_color.rgb;
+ vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
- col.rgb = col.rgb*gl_Color.rgb;
+ col.rgb = col.rgb*diffuse_color.rgb;
gl_FrontColor = col;
gl_FogFragCoord = pos.z;
- pos = gl_ModelViewProjectionMatrix * vert;
+ pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index 80f386ecb0..3e35675784 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -23,7 +23,11 @@
* $/LicenseInfo$
*/
+uniform mat4 projection_matrix;
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
@@ -79,32 +83,31 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
vec3 norm;
mat4 trans = getSkinnedTransform();
- pos.x = dot(trans[0], gl_Vertex);
- pos.y = dot(trans[1], gl_Vertex);
- pos.z = dot(trans[2], gl_Vertex);
+ vec4 pos_in = vec4(position.xyz, 1.0);
+ pos.x = dot(trans[0], pos_in);
+ pos.y = dot(trans[1], pos_in);
+ pos.z = dot(trans[2], pos_in);
pos.w = 1.0;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
calcAtmospherics(pos.xyz);
- //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
-
- vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
+ vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
// Collect normal lights
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
@@ -114,17 +117,17 @@ void main()
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
- vary_pointlight_col = col.rgb*gl_Color.rgb;
+ vary_pointlight_col = col.rgb;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(vec3(0.));
- vary_ambient = col.rgb*gl_Color.rgb;
- vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
+ vary_ambient = col.rgb;
+ vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), 0.0));
- col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
+ col.rgb = min(col.rgb, 1.0);
gl_FrontColor = col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
index 9deff7bb2a..1f5470db3c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
@@ -23,7 +23,9 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 0b31cbefd1..4c92d72f44 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -54,7 +54,10 @@ uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
-varying vec4 vary_light;
+uniform vec3 center;
+uniform float size;
+uniform vec3 color;
+uniform float falloff;
varying vec4 vary_fragcoord;
uniform vec2 screen_res;
@@ -128,9 +131,9 @@ void main()
frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
- vec3 lv = vary_light.xyz-pos.xyz;
+ vec3 lv = center.xyz-pos.xyz;
float dist2 = dot(lv,lv);
- dist2 /= vary_light.w;
+ dist2 /= size;
if (dist2 > 1.0)
{
discard;
@@ -161,7 +164,7 @@ void main()
proj_tc.xyz /= proj_tc.w;
- float fa = gl_Color.a+1.0;
+ float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
if (dist_atten <= 0.0)
{
@@ -193,7 +196,7 @@ void main()
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
- vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+ vec3 lcol = color.rgb * plcol.rgb * plcol.a;
lit = da * dist_atten * noise;
@@ -210,7 +213,7 @@ void main()
amb_da = min(amb_da, 1.0-lit);
- col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
@@ -243,7 +246,7 @@ void main()
stc.y > 0.0)
{
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+ col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index d7407332e5..22f52032a5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -65,7 +65,8 @@ uniform mat3 ssao_effect_mat;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
+
varying vec2 vary_fragcoord;
vec3 vary_PositionEye;
@@ -282,7 +283,7 @@ void main()
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
- float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
+ float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -309,7 +310,7 @@ void main()
// the old infinite-sky shiny reflection
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float sa = dot(refnormpersp, vary_light.xyz);
+ float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index fed238510a..424299269f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -22,23 +22,21 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
uniform vec2 screen_res;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
-
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
- vary_light = gl_MultiTexCoord0;
+ vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 1809cff1e5..146fac56e9 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -48,12 +48,12 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 shadow_res;
uniform vec2 proj_shadow_res;
+uniform vec3 sun_dir;
uniform float shadow_bias;
uniform float shadow_offset;
@@ -132,10 +132,10 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
vec3 shadow_pos = pos.xyz + displace*norm;
- vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+ vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 681186d6b2..60741771d6 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -47,7 +47,7 @@ uniform float ssao_factor;
uniform float ssao_factor_inv;
varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+uniform vec3 sun_dir;
uniform mat4 inv_proj;
uniform vec2 screen_res;
@@ -184,10 +184,10 @@ void main()
}*/
float shadow = 1.0;
- float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
+ float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
vec3 shadow_pos = pos.xyz + displace*norm;
- vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
+ vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index e7ab11c6ed..60ba2d7ad4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -1,5 +1,5 @@
/**
- * @file sunLightF.glsl
+ * @file sunLightV.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -22,10 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
-varying vec4 vary_light;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -33,13 +34,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vary_light = gl_MultiTexCoord0;
-
- gl_FrontColor = gl_Color;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
index 3e47ed15fe..4fd4b101ff 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 texelSize;
uniform vec2 blurDirection;
@@ -32,10 +35,10 @@ uniform float blurWidth;
void main(void)
{
// Transform vertex
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
- vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
+ vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0);
// for (int i = 0; i < 7; i++) {
// gl_TexCoord[i].st = s + (i * blurDelta);
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
index 25806cd914..d3c93ab05f 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
@@ -22,13 +22,18 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void main(void)
{
//transform vertex
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_MultiTexCoord1;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
+ gl_TexCoord[1] = vec4(texcoord1,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
index 36d0c99b63..69f4d4ae45 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
@@ -22,7 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+attribute vec2 texcoord1;
void calcAtmospherics(vec3 inPositionEye);
@@ -46,24 +56,24 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
void main()
{
//transform vertex
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- vec4 pos = gl_ModelViewMatrix * gl_Vertex;
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 pos = modelview_matrix * vec4(position.xyz, 1.0);
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
/// Potentially better without it for water.
pos /= pos.w;
- calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz);
-
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0));
gl_FrontColor = color;
// Transform and pass tex coords
- gl_TexCoord[0].xy = texgen_object(gl_Vertex, gl_MultiTexCoord0, gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
- vec4 t = gl_MultiTexCoord1;
+ vec4 t = vec4(texcoord1,0,1);
gl_TexCoord[0].zw = t.xy;
gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
index ad045a3058..55dfab2aa1 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-
-
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
index 819b28e4fd..b9eff87a13 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
void calcAtmospherics(vec3 inPositionEye);
@@ -31,23 +36,28 @@ uniform vec4 origin;
varying float vary_texture_index;
+attribute vec4 position;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
+
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
index abf6e37b7c..b7f7af7885 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
@@ -22,7 +22,15 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
void calcAtmospherics(vec3 inPositionEye);
@@ -32,16 +40,15 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
- vec4 pos = (gl_ModelViewMatrix * vert);
-
calcAtmospherics(pos.xyz);
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
index 44c711701b..4511c4bc91 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
@@ -22,8 +22,17 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
@@ -36,20 +45,20 @@ uniform vec4 origin;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
-
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ vec3 norm = normalize(normal_matrix * normal);
vec3 ref = reflect(pos.xyz, -norm);
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
- gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+ gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
calcAtmospherics(pos.xyz);
- gl_FrontColor = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+ gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));
gl_FogFragCoord = pos.z;
}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
new file mode 100644
index 0000000000..5f78495ae3
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
@@ -0,0 +1,57 @@
+/**
+ * @file simpleNonIndexedV.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
+
+vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
+void calcAtmospherics(vec3 inPositionEye);
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+
+ gl_Position = modelview_projection_matrix*vert;
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+
+ vec4 pos = (modelview_matrix * vert);
+
+ vec3 norm = normalize(normal_matrix * normal);
+
+ calcAtmospherics(pos.xyz);
+
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
+ gl_FrontColor = color;
+
+ gl_FogFragCoord = pos.z;
+}
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
index b0114763c1..91ee5e016e 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
@@ -22,8 +22,16 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+attribute vec4 position;
+attribute vec2 texcoord0;
+attribute vec3 normal;
+attribute vec4 diffuse_color;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -33,18 +41,19 @@ varying float vary_texture_index;
void main()
{
//transform vertex
- vec4 vert = vec4(gl_Vertex.xyz,1.0);
- vary_texture_index = gl_Vertex.w;
- gl_Position = gl_ModelViewProjectionMatrix*vert;
- gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
+ vec4 vert = vec4(position.xyz,1.0);
+ vary_texture_index = position.w;
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+
- vec4 pos = (gl_ModelViewMatrix * vert);
- vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 norm = normalize(normal_matrix * normal);
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
+ vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
gl_FrontColor = color;
gl_FogFragCoord = pos.z;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index c175a834c2..67b5e7fb83 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
//////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -59,12 +62,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
@@ -160,7 +163,7 @@ void main()
// Texture coords
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
gl_TexCoord[0].xy -= 0.5;
gl_TexCoord[0].xy /= cloud_scale.x;
gl_TexCoord[0].xy += 0.5;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 3a44bb6d26..50fdba64c2 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -23,7 +23,10 @@
* $/LicenseInfo$
*/
+uniform mat4 modelview_projection_matrix;
+attribute vec3 position;
+attribute vec2 texcoord0;
// SKY ////////////////////////////////////////////////////////////////////////
// The vertex shader for creating the atmospheric sky
@@ -57,12 +60,12 @@ void main()
{
// World / view / projection
- gl_Position = ftransform();
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
// Get relative position
- vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
- //vec3 P = gl_Vertex.xyz + vec3(0,50,0);
+ vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
+ //vec3 P = position.xyz + vec3(0,50,0);
// Set altitude
if (P.y > 0.)
diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
index 151602dbc0..c10635c898 100644
--- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
@@ -22,39 +22,42 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 projection_matrix;
+
+attribute vec3 position;
+attribute vec3 normal;
+attribute vec2 texcoord0;
+attribute vec4 clothing;
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
mat4 getSkinnedTransform();
void calcAtmospherics(vec3 inPositionEye);
-attribute vec4 clothing; //4
-
-attribute vec4 gWindDir; //7
-attribute vec4 gSinWaveParams; //3
-attribute vec4 gGravity; //5
+uniform vec4 gWindDir;
+uniform vec4 gSinWaveParams;
+uniform vec4 gGravity;
const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542); // #minimax-generated coefficients
const vec4 gPiConstants = vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); // # {1/2PI, 2PI, PI, PI/2}
void main()
{
- gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = vec4(texcoord0,0,1);
vec4 pos;
mat4 trans = getSkinnedTransform();
vec3 norm;
- norm.x = dot(trans[0].xyz, gl_Normal);
- norm.y = dot(trans[1].xyz, gl_Normal);
- norm.z = dot(trans[2].xyz, gl_Normal);
+ norm.x = dot(trans[0].xyz, normal);
+ norm.y = dot(trans[1].xyz, normal);
+ norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
//wind
vec4 windEffect;
windEffect = vec4(dot(norm, gWindDir.xyz));
- pos.x = dot(trans[2].xyz, gl_Vertex.xyz);
+ pos.x = dot(trans[2].xyz, position.xyz);
windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015)
+ windEffect.xyz;
windEffect.w = windEffect.w * 2.0 + 1.0; // move wind offset value to [-1, 3]
@@ -101,7 +104,7 @@ void main()
sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0)); // clamp to underlying body shape
offsetPos = clothing * sinWave.x; // multiply wind effect times clothing displacement
temp2 = gWindDir*sinWave.z + vec4(norm,0); // calculate normal offset due to wind oscillation
- offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+gl_Vertex; // add to offset vertex position, and zero out effect from w
+ offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+vec4(position.xyz, 1.0); // add to offset vertex position, and zero out effect from w
norm += temp2.xyz*2.0; // add sin wave effect on normals (exaggerated)
//add "backlighting" effect
@@ -119,10 +122,10 @@ void main()
calcAtmospherics(pos.xyz);
- vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));
+ vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0));
gl_FrontColor = color;
- gl_Position = gl_ProjectionMatrix * pos;
+ gl_Position = projection_matrix * pos;
gl_TexCoord[2] = vec4(pos.xyz, 1.0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
index 6231ee68b7..5e75aec171 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
@@ -22,8 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
index a6a206502c..969b6e2f1c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
@@ -22,7 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
@@ -31,7 +34,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
index 190e32b6a3..2766691bd0 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
@@ -22,7 +22,12 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec4 diffuse_color;
+attribute vec2 texcoord0;
varying vec2 vary_fragcoord;
@@ -32,11 +37,12 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
+ vec4 tex = vec4(texcoord0,0,1);
tex.w = 1.0;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
index 2d99ef5481..d0205fa824 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
@@ -22,19 +22,23 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
+attribute vec3 position;
+attribute vec4 diffuse_color;
+
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
+
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
- gl_FrontColor = gl_Color;
+ gl_FrontColor = diffuse_color;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
index cb83dda795..2d7fa22edc 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
@@ -22,8 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
index 6231ee68b7..e9c6f3e27b 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
@@ -22,8 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
varying vec2 vary_fragcoord;
uniform vec2 screen_res;
@@ -31,7 +33,7 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- gl_Position = ftransform();
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
index fed238510a..8e405de9a3 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
@@ -22,8 +22,11 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
+uniform mat4 modelview_projection_matrix;
+
+attribute vec3 position;
+attribute vec2 texcoord0;
uniform vec2 screen_res;
@@ -32,13 +35,10 @@ varying vec2 vary_fragcoord;
void main()
{
//transform vertex
- gl_Position = ftransform();
+ vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = pos;
- vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
- vec4 tex = gl_MultiTexCoord0;
- tex.w = 1.0;
-
- vary_light = gl_MultiTexCoord0;
+ vary_light = vec4(texcoord0,0,1);
}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
index dcdc72ac02..c31afb6268 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl
@@ -24,7 +24,6 @@
*/
-
float calcDirectionalLight(vec3 n, vec3 l);
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 642a1907f0..48afe77827 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3918,14 +3918,14 @@ void LLAgent::renderAutoPilotTarget()
F32 height_meters;
LLVector3d target_global;
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
// not textured
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// lovely green
- glColor4f(0.f, 1.f, 1.f, 1.f);
+ gGL.color4f(0.f, 1.f, 1.f, 1.f);
target_global = mAutoPilotTargetGlobal;
@@ -3933,9 +3933,9 @@ void LLAgent::renderAutoPilotTarget()
height_meters = 1.f;
- glScalef(height_meters, height_meters, height_meters);
+ gGL.scalef(height_meters, height_meters, height_meters);
- gSphere.render(1500.f);
+ gSphere.render();
gGL.popMatrix();
}
diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp
index 4901e29691..2adc071d7a 100644
--- a/indra/newview/llcylinder.cpp
+++ b/indra/newview/llcylinder.cpp
@@ -37,261 +37,39 @@
#include "llgl.h"
#include "llglheaders.h"
-LLCylinder gCylinder;
LLCone gCone;
-GLUquadricObj* gQuadObj = NULL;
-
-static const GLint SLICES[] = { 30, 20, 12, 6 }; // same as sphere slices
-static const GLint STACKS = 2;
-static const GLfloat RADIUS = 0.5f;
-
-// draws a cylinder or cone
-// returns approximate number of triangles required
-U32 draw_cylinder_side(GLint slices, GLint stacks, GLfloat base_radius, GLfloat top_radius)
-{
- U32 triangles = 0;
- GLfloat height = 1.0f;
-
- if (!gQuadObj)
- {
- gQuadObj = gluNewQuadric();
- if (!gQuadObj) llerror("draw_cylindrical_body couldn't allocated quadric", 0);
- }
-
- gluQuadricDrawStyle(gQuadObj, GLU_FILL);
- gluQuadricNormals(gQuadObj, GLU_SMOOTH);
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- gluQuadricTexture(gQuadObj, GL_TRUE);
- gluCylinder(gQuadObj, base_radius, top_radius, height, slices, stacks);
- triangles += stacks * (slices * 2);
-
-
- return triangles;
-}
-
-
-// Returns number of triangles required to draw
-// Need to know if top or not to set lighting normals
-const BOOL TOP = TRUE;
-const BOOL BOTTOM = FALSE;
-U32 draw_cylinder_cap(GLint slices, GLfloat base_radius, BOOL is_top)
-{
- U32 triangles = 0;
-
- if (!gQuadObj)
- {
- gQuadObj = gluNewQuadric();
- if (!gQuadObj) llerror("draw_cylinder_base couldn't allocated quadric", 0);
- }
-
- gluQuadricDrawStyle(gQuadObj, GLU_FILL);
- gluQuadricNormals(gQuadObj, GLU_SMOOTH);
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- gluQuadricTexture(gQuadObj, GL_TRUE);
-
- // no hole in the middle of the disk, and just one ring
- GLdouble inner_radius = 0.0;
- GLint rings = 1;
-
- // normals point in +z for top, -z for base
- if (is_top)
- {
- gluQuadricOrientation(gQuadObj, GLU_OUTSIDE);
- }
- else
- {
- gluQuadricOrientation(gQuadObj, GLU_INSIDE);
- }
- gluDisk(gQuadObj, inner_radius, base_radius, slices, rings);
- triangles += slices;
-
- return triangles;
-}
-
-void LLCylinder::drawSide(S32 detail)
-{
- draw_cylinder_side(SLICES[detail], STACKS, RADIUS, RADIUS);
-}
-
-void LLCylinder::drawTop(S32 detail)
-{
- draw_cylinder_cap(SLICES[detail], RADIUS, TOP);
-}
-
-void LLCylinder::drawBottom(S32 detail)
-{
- draw_cylinder_cap(SLICES[detail], RADIUS, BOTTOM);
-}
-
-void LLCylinder::prerender()
-{
-}
-
-void LLCylinder::cleanupGL()
-{
- if (gQuadObj)
- {
- gluDeleteQuadric(gQuadObj);
- gQuadObj = NULL;
- }
-}
-
-void LLCylinder::render(F32 pixel_area)
-{
- renderface(pixel_area, 0);
- renderface(pixel_area, 1);
- renderface(pixel_area, 2);
-}
-
-
-void LLCylinder::renderface(F32 pixel_area, S32 face)
-{
- if (face < 0 || face > 2)
- {
- llerror("LLCylinder::renderface() invalid face number", face);
- return;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- S32 level_of_detail;
-
- if (pixel_area > 20000.f)
- {
- level_of_detail = 0;
- }
- else if (pixel_area > 1600.f)
- {
- level_of_detail = 1;
- }
- else if (pixel_area > 200.f)
- {
- level_of_detail = 2;
- }
- else
- {
- level_of_detail = 3;
- }
-
- if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail)
- {
- llerror("LLCylinder::renderface() invalid level of detail", level_of_detail);
- return;
- }
-
- LLVertexBuffer::unbind();
-
- switch(face)
- {
- case 0:
- glTranslatef(0.f, 0.f, -0.5f);
- drawSide(level_of_detail);
- break;
- case 1:
- glTranslatef(0.0f, 0.f, 0.5f);
- drawTop(level_of_detail);
- break;
- case 2:
- glTranslatef(0.0f, 0.f, -0.5f);
- drawBottom(level_of_detail);
- break;
- default:
- llerror("LLCylinder::renderface() fell out of switch", 0);
- break;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-}
-
-
//
// Cones
//
-void LLCone::prerender()
+void LLCone::render(S32 sides)
{
-}
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0,0,0);
-void LLCone::cleanupGL()
-{
- if (gQuadObj)
+ for (U32 i = 0; i < sides; i++)
{
- gluDeleteQuadric(gQuadObj);
- gQuadObj = NULL;
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,0.f);
}
-}
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f);
-void LLCone::drawSide(S32 detail)
-{
- draw_cylinder_side( SLICES[detail], STACKS, RADIUS, 0.f );
-}
-
-void LLCone::drawBottom(S32 detail)
-{
- draw_cylinder_cap( SLICES[detail], RADIUS, BOTTOM );
-}
-
-void LLCone::render(S32 level_of_detail)
-{
- GLfloat height = 1.0f;
+ gGL.end();
- if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
+ gGL.begin(LLRender::TRIANGLE_FAN);
+ gGL.vertex3f(0.f, 0.f, 1.f);
+ for (U32 i = 0; i < sides; i++)
{
- llerror("LLCone::render() invalid level of detail", level_of_detail);
- return;
+ F32 a = (F32) i/sides * F_PI*2.f;
+ F32 x = cosf(a)*0.5f;
+ F32 y = sinf(a)*0.5f;
+ gGL.vertex3f(x,y,0.f);
}
+ gGL.vertex3f(cosf(0.f)*0.5f, sinf(0.f)*0.5f, 0.f);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- // center object at 0
- glTranslatef(0.f, 0.f, - height / 2.0f);
-
- drawSide(level_of_detail);
- drawBottom(level_of_detail);
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.end();
}
-
-void LLCone::renderface(S32 level_of_detail, S32 face)
-{
- if (face < 0 || face > 1)
- {
- llerror("LLCone::renderface() invalid face number", face);
- return;
- }
-
- if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
- {
- llerror("LLCone::renderface() invalid level of detail", level_of_detail);
- return;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- LLVertexBuffer::unbind();
-
- switch(face)
- {
- case 0:
- glTranslatef(0.f, 0.f, -0.5f);
- drawSide(level_of_detail);
- break;
- case 1:
- glTranslatef(0.f, 0.f, -0.5f);
- drawBottom(level_of_detail);
- break;
- default:
- llerror("LLCylinder::renderface() fell out of switch", 0);
- break;
- }
-
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-}
diff --git a/indra/newview/llcylinder.h b/indra/newview/llcylinder.h
index 40a669ceb6..4369f06659 100644
--- a/indra/newview/llcylinder.h
+++ b/indra/newview/llcylinder.h
@@ -30,45 +30,18 @@
//#include "stdtypes.h"
//#include "llgl.h"
-//
-// Cylinders
-//
-const S32 CYLINDER_LEVELS_OF_DETAIL = 4;
-const S32 CYLINDER_FACES = 3;
-
-class LLCylinder
-{
-public:
- void prerender();
- void drawTop(S32 detail);
- void drawSide(S32 detail);
- void drawBottom(S32 detail);
- void cleanupGL();
-
- void render(F32 pixel_area);
- void renderface(F32 pixel_area, S32 face);
-};
-
+#include "llvertexbuffer.h"
//
// Cones
//
-const S32 CONE_LOD_HIGHEST = 0;
-const S32 CONE_LEVELS_OF_DETAIL = 4;
-const S32 CONE_FACES = 2;
-
class LLCone
{
public:
- void prerender();
- void cleanupGL();
- void drawSide(S32 detail);
- void drawBottom(S32 detail);
- void render(S32 level_of_detail);
- void renderface(S32 level_of_detail, S32 face);
+ void render(S32 sides = 12);
};
-extern LLCylinder gCylinder;
+
extern LLCone gCone;
#endif
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 286284f828..35f8a85796 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -384,7 +384,7 @@ BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE;
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4& color)
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
}
void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
@@ -394,7 +394,7 @@ void LLFacePool::LLOverrideFaceColor::setColor(const LLColor4U& color)
void LLFacePool::LLOverrideFaceColor::setColor(F32 r, F32 g, F32 b, F32 a)
{
- glColor4f(r,g,b,a);
+ gGL.diffuseColor4f(r,g,b,a);
}
@@ -457,10 +457,10 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params)
if (params.mModelMatrix != gGLLastMatrix)
{
gGLLastMatrix = params.mModelMatrix;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
if (params.mModelMatrix)
{
- glMultMatrixf((GLfloat*) params.mModelMatrix->mMatrix);
+ gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
}
@@ -494,8 +494,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
{
tex_setup = true;
gGL.getTexUnit(0)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
}
}
@@ -519,8 +519,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
if (tex_setup)
{
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9719140a37..a5032d007f 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -54,7 +54,7 @@ static BOOL deferred_render = FALSE;
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
- simple_shader(NULL), fullbright_shader(NULL),
+ simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL),
mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
{
@@ -175,11 +175,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveWaterProgram;
}
else
{
simple_shader = &gObjectSimpleAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveProgram;
}
if (mVertexShaderLevel > 0)
@@ -319,20 +321,21 @@ void LLDrawPoolAlpha::render(S32 pass)
BOOL shaders = gPipeline.canUseVertexShaders();
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.bind();
+ gHighlightProgram.bind();
}
else
{
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
}
- glColor4f(1,0,0,1);
+ gGL.diffuseColor4f(1,0,0,1);
+
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0);
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.unbind();
+ gHighlightProgram.unbind();
}
}
}
@@ -472,8 +475,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
{
tex_setup = true;
gGL.getTexUnit(0)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
}
}
@@ -488,30 +491,34 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
- if (draw_glow_for_this_partition &&
- params.mGlowColor.mV[3] > 0)
+ if (current_shader &&
+ draw_glow_for_this_partition &&
+ params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
{
// install glow-accumulating blend mode
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
+ emissive_shader->bind();
+
// glow doesn't use vertex colors from the mesh data
- params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR);
- glColor4ubv(params.mGlowColor.mV);
-
+ params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
+
// do the actual drawing, again
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// restore our alpha blend mode
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
+ current_shader->bind();
}
if (tex_setup)
{
gGL.getTexUnit(0)->activate();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
}
}
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index 12a7ae92b1..a4245e561d 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -78,6 +78,7 @@ private:
LLGLSLShader* target_shader;
LLGLSLShader* simple_shader;
LLGLSLShader* fullbright_shader;
+ LLGLSLShader* emissive_shader;
// our 'normal' alpha blend function for this pass
LLRender::eBlendFactor mColorSFactor;
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 28e464b60d..f161790b99 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -263,7 +263,6 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
@@ -271,7 +270,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
sVertexProgram = &gDeferredSkinnedAlphaProgram;
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
gPipeline.enableLightsDynamic();
}
@@ -280,7 +278,6 @@ void LLDrawPoolAvatar::endDeferredRiggedAlpha()
LLVertexBuffer::unbind();
gPipeline.unbindDeferredShader(*sVertexProgram);
sDiffuseChannel = 0;
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
@@ -314,8 +311,7 @@ void LLDrawPoolAvatar::endPostDeferredAlpha()
// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
sRenderingSkinned = FALSE;
sSkipOpaque = FALSE;
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
+
gPipeline.unbindDeferredShader(*sVertexProgram);
sDiffuseChannel = 0;
sShaderLevel = mVertexShaderLevel;
@@ -356,27 +352,22 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
if (pass == 0)
{
sVertexProgram = &gDeferredAvatarShadowProgram;
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
- //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
- glColor4f(1,1,1,1);
+ //gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
if ((sShaderLevel > 0)) // for hardware blending
{
sRenderingSkinned = TRUE;
sVertexProgram->bind();
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
+
+ gGL.diffuseColor4f(1,1,1,1);
}
else
{
sVertexProgram = &gDeferredAttachmentShadowProgram;
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -389,14 +380,12 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass)
{
sRenderingSkinned = FALSE;
sVertexProgram->unbind();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
}
}
else
{
LLVertexBuffer::unbind();
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
}
@@ -430,11 +419,6 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
if (pass == 0)
{
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
-
avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
}
else
@@ -492,11 +476,6 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
//reset vertex buffer mappings
LLVertexBuffer::unbind();
- if (pass == 0)
- { //make sure no stale colors are left over from a previous render
- glColor4f(1,1,1,1);
- }
-
if (LLPipeline::sImpostorRender)
{ //impostor render does not have impostors or rigid rendering
pass += 2;
@@ -535,6 +514,11 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
beginRiggedGlow();
break;
}
+
+ if (pass == 0)
+ { //make sure no stale colors are left over from a previous render
+ gGL.diffuseColor4f(1,1,1,1);
+ }
}
void LLDrawPoolAvatar::endRenderPass(S32 pass)
@@ -614,11 +598,11 @@ void LLDrawPoolAvatar::beginRigid()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
}
else
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorProgram;
}
if (sVertexProgram != NULL)
@@ -672,9 +656,10 @@ void LLDrawPoolAvatar::endDeferredImpostor()
void LLDrawPoolAvatar::beginDeferredRigid()
{
- sVertexProgram = &gDeferredNonIndexedDiffuseProgram;
+ sVertexProgram = &gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
}
void LLDrawPoolAvatar::endDeferredRigid()
@@ -703,11 +688,11 @@ void LLDrawPoolAvatar::beginSkinned()
{
if (LLPipeline::sUnderWaterRender)
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedWaterProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorWaterProgram;
}
else
{
- sVertexProgram = &gObjectAlphaMaskNonIndexedProgram;
+ sVertexProgram = &gObjectAlphaMaskNoColorProgram;
}
}
@@ -716,17 +701,6 @@ void LLDrawPoolAvatar::beginSkinned()
sRenderingSkinned = TRUE;
sVertexProgram->bind();
- if (sShaderLevel >= SHADER_LEVEL_CLOTH)
- {
- enable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
- }
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
- if (sShaderLevel >= SHADER_LEVEL_BUMP)
- {
- enable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
- }
-
sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
}
@@ -754,16 +728,6 @@ void LLDrawPoolAvatar::endSkinned()
sRenderingSkinned = FALSE;
sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
gGL.getTexUnit(0)->activate();
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
- if (sShaderLevel >= SHADER_LEVEL_BUMP)
- {
- disable_binormals(sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL]);
- }
- if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
- {
- disable_cloth_weights(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING]);
- }
-
sVertexProgram->unbind();
sShaderLevel = mVertexShaderLevel;
}
@@ -809,7 +773,6 @@ void LLDrawPoolAvatar::beginRiggedSimple()
{
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -820,7 +783,6 @@ void LLDrawPoolAvatar::endRiggedSimple()
{
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -847,7 +809,34 @@ void LLDrawPoolAvatar::endRiggedFullbrightAlpha()
void LLDrawPoolAvatar::beginRiggedGlow()
{
- beginRiggedFullbright();
+ if (sShaderLevel > 0)
+ {
+ if (LLPipeline::sUnderWaterRender)
+ {
+ sVertexProgram = &gSkinnedObjectEmissiveWaterProgram;
+ }
+ else
+ {
+ sVertexProgram = &gSkinnedObjectEmissiveProgram;
+ }
+ }
+ else
+ {
+ if (LLPipeline::sUnderWaterRender)
+ {
+ sVertexProgram = &gObjectEmissiveNonIndexedWaterProgram;
+ }
+ else
+ {
+ sVertexProgram = &gObjectEmissiveNonIndexedProgram;
+ }
+ }
+
+ if (sShaderLevel > 0 || gPipeline.canUseVertexShaders())
+ {
+ sDiffuseChannel = 0;
+ sVertexProgram->bind();
+ }
}
void LLDrawPoolAvatar::endRiggedGlow()
@@ -884,7 +873,6 @@ void LLDrawPoolAvatar::beginRiggedFullbright()
{
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -895,7 +883,6 @@ void LLDrawPoolAvatar::endRiggedFullbright()
{
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -928,7 +915,6 @@ void LLDrawPoolAvatar::beginRiggedShinySimple()
{
sVertexProgram->bind();
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -940,7 +926,6 @@ void LLDrawPoolAvatar::endRiggedShinySimple()
LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -974,7 +959,6 @@ void LLDrawPoolAvatar::beginRiggedFullbrightShiny()
{
sVertexProgram->bind();
LLDrawPoolBump::bindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
}
@@ -986,7 +970,6 @@ void LLDrawPoolAvatar::endRiggedFullbrightShiny()
LLDrawPoolBump::unbindCubeMap(sVertexProgram, 2, sDiffuseChannel, cube_channel, false);
sVertexProgram->unbind();
sVertexProgram = NULL;
- LLVertexBuffer::sWeight4Loc = -1;
}
}
@@ -996,14 +979,12 @@ void LLDrawPoolAvatar::beginDeferredRiggedSimple()
sVertexProgram = &gDeferredSkinnedDiffuseProgram;
sDiffuseChannel = 0;
sVertexProgram->bind();
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endDeferredRiggedSimple()
{
LLVertexBuffer::unbind();
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
sVertexProgram = NULL;
}
@@ -1013,7 +994,6 @@ void LLDrawPoolAvatar::beginDeferredRiggedBump()
sVertexProgram->bind();
normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT);
}
void LLDrawPoolAvatar::endDeferredRiggedBump()
@@ -1022,7 +1002,6 @@ void LLDrawPoolAvatar::endDeferredRiggedBump()
sVertexProgram->disableTexture(LLViewerShaderMgr::BUMP_MAP);
sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
sVertexProgram->unbind();
- LLVertexBuffer::sWeight4Loc = -1;
normal_channel = -1;
sDiffuseChannel = 0;
sVertexProgram = NULL;
@@ -1032,14 +1011,12 @@ void LLDrawPoolAvatar::beginDeferredSkinned()
{
sShaderLevel = mVertexShaderLevel;
sVertexProgram = &gDeferredAvatarProgram;
-
sRenderingSkinned = TRUE;
sVertexProgram->bind();
+ sVertexProgram->setAlphaRange(0.2f, 1.f);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- enable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
-
gGL.getTexUnit(0)->activate();
}
@@ -1047,7 +1024,6 @@ void LLDrawPoolAvatar::endDeferredSkinned()
{
// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
sRenderingSkinned = FALSE;
- disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
sVertexProgram->unbind();
sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -1161,10 +1137,10 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
- if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view
+ /*if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view
{
gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f));
- }
+ }*/
if (pass == 1)
{
@@ -1255,11 +1231,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
- if (sShaderLevel > 0)
- {
- gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
- }
-
if ((sShaderLevel >= SHADER_LEVEL_CLOTH))
{
LLMatrix4 rot_mat;
@@ -1273,16 +1244,16 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
wind = wind * rot_mat;
wind.mV[VW] = avatarp->mWindVec.mV[VW];
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_WIND, wind.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_WIND, 1, wind.mV);
F32 phase = -1.f * (avatarp->mRipplePhase);
F32 freq = 7.f + (noise1(avatarp->mRipplePhase) * 2.f);
LLVector4 sin_params(freq, freq, freq, phase);
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_SINWAVE, sin_params.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_SINWAVE, 1, sin_params.mV);
LLVector4 gravity(0.f, 0.f, -CLOTHING_GRAVITY_EFFECT, 0.f);
gravity = gravity * rot_mat;
- sVertexProgram->vertexAttrib4fv(LLViewerShaderMgr::AVATAR_GRAVITY, gravity.mV);
+ sVertexProgram->uniform4fv(LLViewerShaderMgr::AVATAR_GRAVITY, 1, gravity.mV);
}
if( !single_avatar || (avatarp == single_avatar) )
@@ -1520,7 +1491,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
if (glow)
{
- glColor4f(0,0,0,face->getTextureEntry()->getGlow());
+ gGL.diffuseColor4f(0,0,0,face->getTextureEntry()->getGlow());
}
gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
@@ -1531,11 +1502,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
if (face->mTextureMatrix)
{
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((F32*) face->mTextureMatrix->mMatrix);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((F32*) face->mTextureMatrix->mMatrix);
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
else
{
@@ -1671,34 +1642,3 @@ LLVertexBufferAvatar::LLVertexBufferAvatar()
}
-void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const
-{
- if (sRenderingSkinned)
- {
- U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
-
- glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_VERTEX], (void*)(base + 0));
- glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
-
- set_vertex_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_WEIGHT], (F32*)(base + mOffsets[TYPE_WEIGHT]));
-
- if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_BUMP)
- {
- set_binormals(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::BINORMAL],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_BINORMAL], (LLVector3*)(base + mOffsets[TYPE_BINORMAL]));
- }
-
- if (sShaderLevel >= LLDrawPoolAvatar::SHADER_LEVEL_CLOTH)
- {
- set_vertex_clothing_weights(LLDrawPoolAvatar::sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_CLOTHING],
- LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_CLOTHWEIGHT], (LLVector4*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
- }
- }
- else
- {
- LLVertexBuffer::setupVertexBuffer(data_mask);
- }
-}
-
diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h
index fcd8294af5..e0326bcfaf 100644
--- a/indra/newview/lldrawpoolavatar.h
+++ b/indra/newview/lldrawpoolavatar.h
@@ -176,6 +176,7 @@ public:
RIGGED_FULLBRIGHT_SHINY_MASK = RIGGED_SIMPLE_MASK,
RIGGED_GLOW_MASK = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_EMISSIVE |
LLVertexBuffer::MAP_WEIGHT4,
RIGGED_ALPHA_MASK = RIGGED_SIMPLE_MASK,
RIGGED_FULLBRIGHT_ALPHA_MASK = RIGGED_FULLBRIGHT_MASK,
@@ -214,7 +215,6 @@ class LLVertexBufferAvatar : public LLVertexBuffer
{
public:
LLVertexBufferAvatar();
- virtual void setupVertexBuffer(U32 data_mask) const;
};
extern S32 AVATAR_OFFSET_POS;
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 0742250b0b..501bd88970 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -763,7 +763,7 @@ void LLDrawPoolBump::renderBump(U32 pass)
LLGLDisable fog(GL_FOG);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
LLGLEnable blend(GL_BLEND);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
/// Get rid of z-fighting with non-bump pass.
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -1.0f);
@@ -1369,18 +1369,18 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
if (mShiny)
{
gGL.getTexUnit(0)->activate();
- glMatrixMode(GL_TEXTURE);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
}
else
{
gGL.getTexUnit(1)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
gGL.getTexUnit(0)->activate();
}
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
tex_setup = true;
@@ -1416,11 +1416,11 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
else
{
gGL.getTexUnit(1)->activate();
- glLoadIdentity();
+ gGL.loadIdentity();
gGL.getTexUnit(0)->activate();
}
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
}
@@ -1465,6 +1465,7 @@ void LLDrawPoolInvisible::endDeferredPass( S32 pass )
void LLDrawPoolInvisible::renderDeferred( S32 pass )
{ //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff
+#if 0
LLFastTimer t(FTM_RENDER_INVISIBLE);
U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
@@ -1482,4 +1483,5 @@ void LLDrawPoolInvisible::renderDeferred( S32 pass )
renderShiny(true);
endShiny(true);
}
+#endif
}
diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp
index ce07e62122..59c3fbf7a1 100644
--- a/indra/newview/lldrawpoolground.cpp
+++ b/indra/newview/lldrawpoolground.cpp
@@ -71,9 +71,9 @@ void LLDrawPoolGround::render(S32 pass)
LLGLSquashToFarClip far_clip(glh_get_current_projection());
F32 water_height = gAgent.getRegion()->getWaterHeight();
- glPushMatrix();
+ gGL.pushMatrix();
LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
- glTranslatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
+ gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
LLFace *facep = mDrawFace[0];
@@ -82,6 +82,6 @@ void LLDrawPoolGround::render(S32 pass)
LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor());
facep->renderIndexed();
- glPopMatrix();
+ gGL.popMatrix();
}
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index eec4ee6bac..80c202d4e2 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -46,7 +46,7 @@ static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass");
void LLDrawPoolGlow::beginPostDeferredPass(S32 pass)
{
- gDeferredFullbrightProgram.bind();
+ gDeferredEmissiveProgram.bind();
}
static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push");
@@ -76,10 +76,22 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass)
void LLDrawPoolGlow::endPostDeferredPass(S32 pass)
{
- gDeferredFullbrightProgram.unbind();
+ gDeferredEmissiveProgram.unbind();
LLRenderPass::endRenderPass(pass);
}
+S32 LLDrawPoolGlow::getNumPasses()
+{
+ if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
void LLDrawPoolGlow::render(S32 pass)
{
LLFastTimer t(FTM_RENDER_GLOW);
@@ -93,39 +105,29 @@ void LLDrawPoolGlow::render(S32 pass)
U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
- if (shader_level > 0 && fullbright_shader)
- {
- fullbright_shader->bind();
- }
- else
- {
- gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
- }
+ //should never get here without basic shaders enabled
+ llassert(shader_level > 0);
+
+ LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram;
+ shader->bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
gGL.setColorMask(false, true);
- if (shader_level > 1)
- {
- pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
- }
- else
- {
- renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
- }
+ pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
gGL.setColorMask(true, false);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (shader_level > 0 && fullbright_shader)
{
- fullbright_shader->unbind();
+ shader->unbind();
}
}
void LLDrawPoolGlow::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
{
- glColor4ubv(params.mGlowColor.mV);
+ //gGL.diffuseColor4ubv(params.mGlowColor.mV);
LLRenderPass::pushBatch(params, mask, texture, batch_textures);
}
@@ -253,6 +255,7 @@ void LLDrawPoolGrass::prerender()
void LLDrawPoolGrass::beginRenderPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_GRASS);
+ stop_glerror();
if (LLPipeline::sUnderWaterRender)
{
diff --git a/indra/newview/lldrawpoolsimple.h b/indra/newview/lldrawpoolsimple.h
index 3811b3d398..bd62bc7502 100644
--- a/indra/newview/lldrawpoolsimple.h
+++ b/indra/newview/lldrawpoolsimple.h
@@ -118,7 +118,8 @@ public:
enum
{
VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_TEXCOORD0
+ LLVertexBuffer::MAP_TEXCOORD0 |
+ LLVertexBuffer::MAP_EMISSIVE
};
virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
@@ -130,6 +131,8 @@ public:
/*virtual*/ void endPostDeferredPass(S32 pass);
/*virtual*/ void renderPostDeferred(S32 pass);
+ /*virtual*/ S32 getNumPasses();
+
void render(S32 pass = 0);
void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index efffb2df9e..8a3871b6b4 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -84,7 +84,7 @@ void LLDrawPoolSky::render(S32 pass)
}
else if (LLGLSLShader::sNoFixedFunction)
{ //just use the UI shader (generic single texture no lighting)
- gUIProgram.bind();
+ gOneTextureNoColorProgram.bind();
}
else
{
@@ -111,21 +111,21 @@ void LLDrawPoolSky::render(S32 pass)
LLGLDisable clip(GL_CLIP_PLANE0);
- glPushMatrix();
+ gGL.pushMatrix();
LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
- glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
S32 face_count = (S32)mDrawFace.size();
LLVertexBuffer::unbind();
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
for (S32 i = 0; i < llmin(6, face_count); ++i)
{
renderSkyCubeFace(i);
}
- glPopMatrix();
+ gGL.popMatrix();
}
void LLDrawPoolSky::renderSkyCubeFace(U8 side)
@@ -146,7 +146,7 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side)
LLGLEnable blend(GL_BLEND);
mSkyTex[side].bindTexture(FALSE);
- glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
+ gGL.diffuseColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
face.renderIndexed();
}
}
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 3daa0f8261..3ba4a89686 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -106,6 +106,10 @@ U32 LLDrawPoolTerrain::getVertexDataMask()
{
return LLVertexBuffer::MAP_VERTEX;
}
+ else if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
+ }
else
{
return VERTEX_DATA_MASK;
@@ -319,9 +323,9 @@ void LLDrawPoolTerrain::renderFullShader()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
//
// detail texture 1
@@ -331,9 +335,9 @@ void LLDrawPoolTerrain::renderFullShader()
/// ALPHA TEXTURE COORDS 0:
gGL.getTexUnit(1)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// detail texture 2
//
@@ -343,10 +347,10 @@ void LLDrawPoolTerrain::renderFullShader()
gGL.getTexUnit(2)->activate();
/// ALPHA TEXTURE COORDS 1:
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-2.f, 0.f, 0.f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-2.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
//
// detail texture 3
@@ -356,10 +360,10 @@ void LLDrawPoolTerrain::renderFullShader()
/// ALPHA TEXTURE COORDS 2:
gGL.getTexUnit(3)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-1.f, 0.f, 0.f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-1.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
//
// Alpha Ramp
@@ -382,36 +386,33 @@ void LLDrawPoolTerrain::renderFullShader()
gGL.getTexUnit(4)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
+
gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->disable();
gGL.getTexUnit(3)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->disable();
gGL.getTexUnit(2)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
@@ -421,9 +422,9 @@ void LLDrawPoolTerrain::renderFullShader()
gGL.getTexUnit(0)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
void LLDrawPoolTerrain::renderFull4TU()
@@ -534,9 +535,9 @@ void LLDrawPoolTerrain::renderFull4TU()
gGL.getTexUnit(1)->activate();
// Set the texture matrix
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-2.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-2.f, 0.f, 0.f);
// Care about alpha only
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -566,9 +567,9 @@ void LLDrawPoolTerrain::renderFull4TU()
gGL.getTexUnit(3)->activate();
// Set the texture matrix
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-1.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-1.f, 0.f, 0.f);
// Set alpha texture and do lighting modulation
gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
@@ -586,9 +587,9 @@ void LLDrawPoolTerrain::renderFull4TU()
gGL.getTexUnit(3)->disable();
gGL.getTexUnit(3)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->disable();
@@ -596,17 +597,17 @@ void LLDrawPoolTerrain::renderFull4TU()
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
gGL.getTexUnit(1)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// Restore blend state
gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -620,9 +621,9 @@ void LLDrawPoolTerrain::renderFull4TU()
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
@@ -714,9 +715,9 @@ void LLDrawPoolTerrain::renderFull2TU()
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-1.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-1.f, 0.f, 0.f);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -753,9 +754,9 @@ void LLDrawPoolTerrain::renderFull2TU()
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(-2.f, 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.translatef(-2.f, 0.f, 0.f);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
@@ -793,9 +794,9 @@ void LLDrawPoolTerrain::renderFull2TU()
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
@@ -805,9 +806,9 @@ void LLDrawPoolTerrain::renderFull2TU()
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
@@ -849,9 +850,9 @@ void LLDrawPoolTerrain::renderSimple()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
@@ -882,11 +883,11 @@ void LLDrawPoolTerrain::renderOwnership()
// texture coordinates for pixel 256x256 is not 1,1. This makes the
// ownership map not line up with the selection. We address this with
// a texture matrix multiply.
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.pushMatrix();
const F32 TEXTURE_FUDGE = 257.f / 256.f;
- glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
+ gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
@@ -895,9 +896,9 @@ void LLDrawPoolTerrain::renderOwnership()
LLVertexBuffer::MAP_TEXCOORD0);
}
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index a6e0151114..3fe5b4d929 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -65,17 +65,18 @@ void LLDrawPoolTree::beginRenderPass(S32 pass)
if (LLPipeline::sUnderWaterRender)
{
- shader = &gObjectAlphaMaskNonIndexedWaterProgram;
+ shader = &gTreeWaterProgram;
}
else
{
- shader = &gObjectAlphaMaskNonIndexedProgram;
+ shader = &gTreeProgram;
}
if (gPipeline.canUseVertexShaders())
{
shader->bind();
shader->setAlphaRange(0.5f, 1.f);
+ gGL.diffuseColor4f(1,1,1,1);
}
else
{
@@ -141,7 +142,7 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_TREES);
- shader = &gDeferredNonIndexedDiffuseAlphaMaskProgram;
+ shader = &gDeferredTreeProgram;
shader->bind();
shader->setAlphaRange(0.5f, 1.f);
}
@@ -168,8 +169,8 @@ void LLDrawPoolTree::beginShadowPass(S32 pass)
glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"),
gSavedSettings.getF32("RenderDeferredTreeShadowBias"));
- gDeferredShadowAlphaMaskProgram.bind();
- gDeferredShadowAlphaMaskProgram.setAlphaRange(0.5f, 1.f);
+ gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.setAlphaRange(0.5f, 1.f);
}
void LLDrawPoolTree::renderShadow(S32 pass)
@@ -183,6 +184,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass)
glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"),
gSavedSettings.getF32("RenderDeferredSpotShadowBias"));
+ gDeferredTreeShadowProgram.unbind();
}
@@ -195,7 +197,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
U32 indices_drawn = 0;
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
@@ -226,8 +228,8 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
}
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
- //glPushMatrix();
+ gGL.loadMatrix(gGLModelView);
+ //gGL.pushMatrix();
F32 mat[16];
for (U32 i = 0; i < 16; i++)
mat[i] = (F32) gGLModelView[i];
@@ -236,7 +238,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
// Translate to tree base HACK - adjustment in Z plants tree underground
const LLVector3 &pos_agent = treep->getPositionAgent();
- //glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
+ //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
LLMatrix4 trans_mat;
trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
trans_mat *= matrix;
@@ -307,7 +309,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha);
}
- //glPopMatrix();
+ //gGL.popMatrix();
}
}
}
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 31c14361b5..c97f92fa6f 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -219,7 +219,7 @@ void LLDrawPoolWater::render(S32 pass)
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
}
- glColor4fv(water_color.mV);
+ gGL.diffuseColor4fv(water_color.mV);
// Automatically generate texture coords for detail map
glEnable(GL_TEXTURE_GEN_S); //texture unit 1
@@ -275,15 +275,15 @@ void LLDrawPoolWater::render(S32 pass)
gSky.mVOSkyp->getCubeMap()->enable(0);
gSky.mVOSkyp->getCubeMap()->bind();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview();
LLMatrix4 camera_rot(camera_mat.getMat3());
camera_rot.invert();
- glLoadMatrixf((F32 *)camera_rot.mMatrix);
+ gGL.loadMatrix((F32 *)camera_rot.mMatrix);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
@@ -310,9 +310,9 @@ void LLDrawPoolWater::render(S32 pass)
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
@@ -383,7 +383,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
- glColor3f(1.f, 1.f, 1.f);
+ gGL.diffuseColor3f(1.f, 1.f, 1.f);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
@@ -623,8 +623,6 @@ void LLDrawPoolWater::shade()
water_color.mV[3] = 0.9f;
}
- glColor4fv(water_color.mV);
-
{
LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
LLGLDisable cullface(GL_CULL_FACE);
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 79a835fd14..f2d077030c 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -100,12 +100,12 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )
{
sky_shader =
LLPipeline::sUnderWaterRender ?
- &gObjectSimpleWaterProgram :
+ &gObjectFullbrightNoColorWaterProgram :
&gWLSkyProgram;
cloud_shader =
LLPipeline::sUnderWaterRender ?
- &gObjectSimpleWaterProgram :
+ &gObjectFullbrightNoColorWaterProgram :
&gWLCloudProgram;
}
@@ -130,33 +130,33 @@ void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) cons
llassert_always(NULL != shader);
- glPushMatrix();
+ gGL.pushMatrix();
//chop off translation
if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f)
{
- glTranslatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f);
+ gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f);
}
else
{
- glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
}
// the windlight sky dome works most conveniently in a coordinate system
// where Y is up, so permute our basis vectors accordingly.
- glRotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
+ gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
- glScalef(0.333f, 0.333f, 0.333f);
+ gGL.scalef(0.333f, 0.333f, 0.333f);
- glTranslatef(0.f,-camHeightLocal, 0.f);
+ gGL.translatef(0.f,-camHeightLocal, 0.f);
// Draw WL Sky
shader->uniform3f("camPosLocal", 0.f, camHeightLocal, 0.f);
gSky.mVOWLSkyp->drawDome();
- glPopMatrix();
+ gGL.popMatrix();
}
void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
@@ -197,7 +197,7 @@ void LLDrawPoolWLSky::renderStars(void) const
gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());
gGL.pushMatrix();
- glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
+ gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
// gl_FragColor.rgb = gl_Color.rgb;
// gl_FragColor.a = gl_Color.a * star_alpha.a;
if (LLGLSLShader::sNoFixedFunction)
@@ -269,7 +269,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
{
if (gPipeline.canUseVertexShaders())
{
- gUIProgram.bind();
+ gHighlightProgram.bind();
}
// *NOTE: even though we already bound this texture above for the
// stars register combiners, we bind again here for defensive reasons,
@@ -289,7 +289,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
if (gPipeline.canUseVertexShaders())
{
- gUIProgram.unbind();
+ gHighlightProgram.unbind();
}
}
}
@@ -315,10 +315,10 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
renderSkyHaze(camHeightLocal);
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
- glPushMatrix();
+ gGL.pushMatrix();
- glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
gDeferredStarProgram.bind();
// *NOTE: have to bind a texture here since register combiners blending in
@@ -332,7 +332,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
gDeferredStarProgram.unbind();
- glPopMatrix();
+ gGL.popMatrix();
renderSkyClouds(camHeightLocal);
@@ -360,9 +360,9 @@ void LLDrawPoolWLSky::render(S32 pass)
renderSkyHaze(camHeightLocal);
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
- glPushMatrix();
+ gGL.pushMatrix();
- glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
// *NOTE: have to bind a texture here since register combiners blending in
// renderStars() requires something to be bound and we might as well only
@@ -374,7 +374,7 @@ void LLDrawPoolWLSky::render(S32 pass)
renderStars();
- glPopMatrix();
+ gGL.popMatrix();
renderSkyClouds(camHeightLocal);
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index fb9958ee9d..6f9ff6c210 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -41,6 +41,7 @@
#include "llviewerdisplay.h"
#include "llrender.h"
#include "pipeline.h"
+#include "llglslshader.h"
// static
LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
@@ -207,6 +208,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
return TRUE;
}
+ LLGLSLShader::bindNoShader();
+ LLVertexBuffer::unbind();
+
+ bool no_ff = LLGLSLShader::sNoFixedFunction;
+ LLGLSLShader::sNoFixedFunction = false;
+
BOOL result = FALSE;
BOOL ret = FALSE ;
for( S32 order = 0; order < ORDER_COUNT; order++ )
@@ -237,6 +244,8 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
}
}
+ LLGLSLShader::sNoFixedFunction = no_ff;
+
return ret;
}
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 432e61f6d8..7ae11bff94 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -362,8 +362,8 @@ void LLFace::setSize(S32 num_vertices, S32 num_indices, bool align)
{
if (align)
{
- //allocate vertices in blocks of 4 for alignment
- num_vertices = (num_vertices + 0x3) & ~0x3;
+ //allocate vertices in blocks of 16 for alignment
+ num_vertices = (num_vertices + 0xF) & ~0xF;
}
if (mGeomCount != num_vertices ||
@@ -496,14 +496,14 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
gGL.pushMatrix();
if (mDrawablep->isActive())
{
- glMultMatrixf((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
+ gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix);
}
else
{
- glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
+ gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
}
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
if (mDrawablep->isState(LLDrawable::RIGGED))
{
@@ -515,7 +515,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
{
LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.f, -1.f);
- glMultMatrixf((F32*) volume->getRelativeXform().mMatrix);
+ gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset());
LLVertexBuffer::unbind();
glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions);
@@ -524,6 +524,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords);
}
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
@@ -557,17 +558,17 @@ void LLFace::renderSelectedUV()
// add green dither pattern on top of red/blue gradient
gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE);
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.pushMatrix();
// make green pattern repeat once per texel in red/blue texture
- glScalef(256.f, 256.f, 1.f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.scalef(256.f, 256.f, 1.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
renderSelected(green_imagep, LLColor4::white);
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
}
*/
@@ -1055,6 +1056,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color");
+static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_BINORMAL("Binormal");
static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index");
@@ -1124,6 +1126,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
+ bool rebuild_emissive = rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE);
bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL);
@@ -1758,6 +1761,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
}
+ if (rebuild_emissive)
+ {
+ LLFastTimer t(FTM_FACE_GEOM_EMISSIVE);
+ LLStrider<U8> emissive;
+ mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range);
+
+ U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
+
+ LLVector4a src;
+
+
+ U32 glow32 = glow |
+ (glow << 8) |
+ (glow << 16) |
+ (glow << 24);
+
+ U32 vec[4];
+ vec[0] = vec[1] = vec[2] = vec[3] = glow32;
+
+ src.loadua((F32*) vec);
+
+ LLVector4a* dst = (LLVector4a*) emissive.get();
+ S32 num_vecs = num_vertices/16;
+ if (num_vertices%16 > 0)
+ {
+ ++num_vecs;
+ }
+
+ for (S32 i = 0; i < num_vecs; i++)
+ {
+ dst[i] = src;
+ }
+
+ if (map_range)
+ {
+ mVertexBuffer->setBuffer(0);
+ }
+ }
if (rebuild_tcoord)
{
mTexExtents[0].setVec(0,0);
@@ -2095,7 +2136,7 @@ void LLFace::renderSetColor() const
{
const LLColor4* color = &(getRenderColor());
- glColor4fv(color->mV);
+ gGL.diffuseColor4fv(color->mV);
}
}
@@ -2130,10 +2171,10 @@ S32 LLFace::renderElements(const U16 *index_array) const
}
else
{
- glPushMatrix();
- glMultMatrixf((float*)getRenderMatrix().mMatrix);
+ gGL.pushMatrix();
+ gGL.multMatrix((float*)getRenderMatrix().mMatrix);
ret = pushVertices(index_array);
- glPopMatrix();
+ gGL.popMatrix();
}
return ret;
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index b5eaeecd60..82e4ab61b7 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -329,13 +329,9 @@ public:
{
return lhs->getTexture() < rhs->getTexture();
}
- else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright())
- {
- return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
- }
else
{
- return lte->getGlow() < rte->getGlow();
+ return lte->getBumpShinyFullbright() < rte->getBumpShinyFullbright();
}
}
};
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 366154302c..c24e0014be 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -1107,10 +1107,10 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3);
gGL.pushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-0.05, 1.05, -0.05, 1.05, -1.0, 1.0);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadIdentity();
+ gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f);
//render charts
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1349,7 +1349,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t
buffer.flush();
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 9f0218a95e..54b9a1f27b 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -1062,14 +1062,19 @@ BOOL LLPreviewAnimation::render()
mNeedsUpdate = FALSE;
LLVOAvatar* avatarp = mDummyAvatar;
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
LLGLSUIDefault def;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1077,10 +1082,10 @@ BOOL LLPreviewAnimation::render()
gl_rect_2d_simple( mFullWidth, mFullHeight );
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
gGL.flush();
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index e4d8e3513d..69de15d9ea 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -50,6 +50,7 @@
#include "llvoavatar.h"
#include "pipeline.h"
#include "lluictrlfactory.h"
+#include "llviewershadermgr.h"
#include "llviewertexturelist.h"
#include "llstring.h"
@@ -649,25 +650,30 @@ BOOL LLImagePreviewAvatar::render()
gGL.pushUIMatrix();
gGL.loadUIIdentity();
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
LLGLSUIDefault def;
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
gl_rect_2d_simple( mFullWidth, mFullHeight );
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
gGL.flush();
@@ -690,8 +696,7 @@ BOOL LLImagePreviewAvatar::render()
LLVertexBuffer::unbind();
avatarp->updateLOD();
-
-
+
if (avatarp->mDrawable.notNull())
{
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
@@ -699,7 +704,7 @@ BOOL LLImagePreviewAvatar::render()
LLGLDisable no_blend(GL_BLEND);
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
-
+ gPipeline.enableLightsPreview();
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
}
@@ -790,15 +795,17 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
U32 num_indices = vf.mNumIndices;
U32 num_vertices = vf.mNumVertices;
- mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL, 0);
+ mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0, 0);
mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE);
LLStrider<LLVector3> vertex_strider;
LLStrider<LLVector3> normal_strider;
+ LLStrider<LLVector2> tc_strider;
LLStrider<U16> index_strider;
mVertexBuffer->getVertexStrider(vertex_strider);
mVertexBuffer->getNormalStrider(normal_strider);
+ mVertexBuffer->getTexCoord0Strider(tc_strider);
mVertexBuffer->getIndexStrider(index_strider);
// build vertices and normals
@@ -806,7 +813,8 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
pos = (LLVector3*) vf.mPositions; pos.setStride(16);
LLStrider<LLVector3> norm;
norm = (LLVector3*) vf.mNormals; norm.setStride(16);
-
+ LLStrider<LLVector2> tc;
+ tc = (LLVector2*) vf.mTexCoords; tc.setStride(8);
for (U32 i = 0; i < num_vertices; i++)
{
@@ -814,6 +822,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
LLVector3 normal = *norm++;
normal.normalize();
*(normal_strider++) = normal;
+ *(tc_strider++) = *tc++;
}
// build indices
@@ -835,23 +844,28 @@ BOOL LLImagePreviewSculpted::render()
LLGLEnable cull(GL_CULL_FACE);
LLGLDepthTest depth(GL_TRUE);
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
- gl_rect_2d_simple( mFullWidth, mFullHeight );
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
- glMatrixMode(GL_PROJECTION);
+ gl_rect_2d_simple( mFullWidth, mFullHeight );
+
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
glClear(GL_DEPTH_BUFFER_BIT);
@@ -876,17 +890,28 @@ BOOL LLImagePreviewSculpted::render()
const LLVolumeFace &vf = mVolume->getVolumeFace(0);
U32 num_indices = vf.mNumIndices;
- mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL);
-
gPipeline.enableLightsAvatar();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gObjectPreviewProgram.bind();
+ }
gGL.pushMatrix();
const F32 SCALE = 1.25f;
gGL.scalef(SCALE, SCALE, SCALE);
const F32 BRIGHTNESS = 0.9f;
gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+
+ mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
gGL.popMatrix();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gObjectPreviewProgram.unbind();
+ }
+
return TRUE;
}
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 2510f43aa7..6412a573f5 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -3623,6 +3623,15 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
LLVertexBuffer::unbind();
+ bool no_ff = LLGLSLShader::sNoFixedFunction;
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ LLGLSLShader::sNoFixedFunction = false;
+
+ if (shader)
+ {
+ shader->unbind();
+ }
+
stop_gloderror();
static U32 cur_name = 1;
@@ -4003,6 +4012,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
mResourceCost = calcResourceCost();
+ LLVertexBuffer::unbind();
+ LLGLSLShader::sNoFixedFunction = no_ff;
+ if (shader)
+ {
+ shader->bind();
+ }
+
/*if (which_lod == -1 && mScene[LLModel::LOD_PHYSICS].empty())
{ //build physics scene
mScene[LLModel::LOD_PHYSICS] = mScene[LLModel::LOD_LOW];
@@ -4730,23 +4746,23 @@ BOOL LLModelPreview::render()
{
//clear background to blue
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, width, 0.0f, height, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, width, 0.0f, height, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
gGL.color4f(0.169f, 0.169f, 0.169f, 1.f);
gl_rect_2d_simple( width, height );
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
@@ -4856,7 +4872,7 @@ BOOL LLModelPreview::render()
refresh();
}
- glLoadIdentity();
+ gGL.loadIdentity();
gPipeline.enableLightsPreview();
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
@@ -4935,7 +4951,7 @@ BOOL LLModelPreview::render()
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
- glMultMatrixf((GLfloat*) mat.mMatrix);
+ gGL.multMatrix((GLfloat*) mat.mMatrix);
for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i)
{
@@ -4950,7 +4966,8 @@ BOOL LLModelPreview::render()
llassert(binding == model->mMaterialList[i]);
- glColor4fv(material.mDiffuseColor.mV);
+ gGL.diffuseColor4fv(material.mDiffuseColor.mV);
+
if (material.mDiffuseMap.notNull())
{
if (material.mDiffuseMap->getDiscardLevel() > -1)
@@ -4962,12 +4979,12 @@ BOOL LLModelPreview::render()
}
else
{
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
}
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor3f(0.4f, 0.4f, 0.4f);
+ gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
if (edges)
{
@@ -5001,7 +5018,7 @@ BOOL LLModelPreview::render()
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
- glMultMatrixf((GLfloat*) mat.mMatrix);
+ gGL.multMatrix((GLfloat*) mat.mMatrix);
bool render_mesh = true;
@@ -5069,11 +5086,11 @@ BOOL LLModelPreview::render()
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor4f(0.4f, 0.4f, 0.0f, 0.4f);
+ gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
- glColor3f(1.f, 1.f, 0.f);
+ gGL.diffuseColor3f(1.f, 1.f, 0.f);
glLineWidth(2.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -5093,7 +5110,7 @@ BOOL LLModelPreview::render()
//show degenerate triangles
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
LLGLDisable cull(GL_CULL_FACE);
- glColor4f(1.f,0.f,0.f,1.f);
+ gGL.diffuseColor4f(1.f,0.f,0.f,1.f);
const LLVector4a scale(0.5f);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
@@ -5110,7 +5127,7 @@ BOOL LLModelPreview::render()
gGL.pushMatrix();
LLMatrix4 mat = instance.mTransform;
- glMultMatrixf((GLfloat*) mat.mMatrix);
+ gGL.multMatrix((GLfloat*) mat.mMatrix);
LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
@@ -5258,11 +5275,12 @@ BOOL LLModelPreview::render()
const std::string& binding = instance.mModel->mMaterialList[i];
const LLImportMaterial& material = instance.mMaterial[binding];
+
buffer->setBuffer(type_mask & buffer->getTypeMask());
- glColor4fv(material.mDiffuseColor.mV);
+ gGL.diffuseColor4fv(material.mDiffuseColor.mV);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
- glColor3f(0.4f, 0.4f, 0.4f);
+ gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
if (edges)
{
diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp
index 3bcbb987f7..2fd7c0ef0e 100644
--- a/indra/newview/llfloaterpostcard.cpp
+++ b/indra/newview/llfloaterpostcard.cpp
@@ -159,11 +159,11 @@ void LLFloaterPostcard::draw()
}
{
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.pushMatrix();
{
- glScalef(mImageScale.mV[VX], mImageScale.mV[VY], 1.f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.scalef(mImageScale.mV[VX], mImageScale.mV[VY], 1.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gl_draw_scaled_image(rect.mLeft,
rect.mBottom,
rect.getWidth(),
@@ -171,9 +171,9 @@ void LLFloaterPostcard::draw()
mViewerImage.get(),
LLColor4::white % alpha);
}
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
}
}
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 00dc7b1627..a6678b9fee 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -445,9 +445,9 @@ void LLSnapshotLivePreview::draw()
// calculate UV scale
F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f);
F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f);
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f);
+ gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f);
gGL.begin(LLRender::QUADS);
{
gGL.texCoord2f(uv_width, uv_height);
@@ -464,7 +464,7 @@ void LLSnapshotLivePreview::draw()
}
gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha);
gl_rect_2d(getRect());
@@ -580,11 +580,11 @@ void LLSnapshotLivePreview::draw()
BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull();
F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f;
F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f;
- glPushMatrix();
+ gGL.pushMatrix();
{
LLRect& rect = mImageRect[old_image_index];
- glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
- glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
+ gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
+ gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
gGL.begin(LLRender::QUADS);
{
gGL.texCoord2f(uv_width, uv_height);
@@ -601,7 +601,7 @@ void LLSnapshotLivePreview::draw()
}
gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
}
}
@@ -2226,7 +2226,7 @@ void LLFloaterSnapshot::draw()
S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ;
S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ;
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// Apply floater transparency to the texture unless the floater is focused.
F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
gl_draw_scaled_image(offset_x, offset_y,
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index fa3f546157..8c872283bd 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -115,7 +115,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
S32 center_y = (top + bottom) / 2;
// save drawing mode
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance");
@@ -230,9 +230,9 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
}
// restore drawing mode
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// restore camera
LLViewerCamera::getInstance()->setFar(old_far_plane);
diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp
index 37b7b2e75d..8abad3d292 100644
--- a/indra/newview/llhudeffectbeam.cpp
+++ b/indra/newview/llhudeffectbeam.cpp
@@ -295,13 +295,13 @@ void LLHUDEffectBeam::render()
F32 alpha = mFadeInterp.getCurVal()*mColor.mV[3];
alpha *= mInterpFade[i].getCurVal();
coloru.mV[3] = (U8)alpha;
- glColor4ubv(coloru.mV);
+ gGL.color4ubv(coloru.mV);
- glPushMatrix();
- glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
- glScalef(scale, scale, scale);
- gSphere.render(0);
- glPopMatrix();
+ gGL.pushMatrix();
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+ gGL.scalef(scale, scale, scale);
+ gSphere.render();
+ gGL.popMatrix();
}
}
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index b380b3fe20..bc3b220dc0 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -498,10 +498,10 @@ void LLHUDEffectLookAt::render()
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
- glScalef(0.3f, 0.3f, 0.3f);
+ gGL.scalef(0.3f, 0.3f, 0.3f);
gGL.begin(LLRender::LINES);
{
LLColor3 color = (*mAttentions)[mTargetType].mColor;
diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp
index 28fe8e1c01..114a633821 100644
--- a/indra/newview/llhudeffectpointat.cpp
+++ b/indra/newview/llhudeffectpointat.cpp
@@ -327,7 +327,7 @@ void LLHUDEffectPointAt::render()
LLVector3 target = mTargetPos + mSourceObject->getRenderPosition();
gGL.pushMatrix();
gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]);
- glScalef(0.3f, 0.3f, 0.3f);
+ gGL.scalef(0.3f, 0.3f, 0.3f);
gGL.begin(LLRender::LINES);
{
gGL.color3f(1.f, 0.f, 0.f);
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 1156e764a1..607f7f7f4b 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -112,9 +112,9 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
&winX, &winY, &winZ);
//fonts all render orthographically, set up projection``
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
LLUI::pushMatrix();
@@ -124,7 +124,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
winX -= world_view_rect.mLeft;
winY -= world_view_rect.mBottom;
LLUI::loadIdentity();
- glLoadIdentity();
+ gGL.loadIdentity();
LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
F32 right_x;
@@ -133,7 +133,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
LLUI::popMatrix();
gGL.popMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 85e0043651..6e0f360cbc 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -372,14 +372,14 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
//LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent();
LLVector3 center_agent = getPivotPoint();
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
+ gGL.translatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]);
F32 angle_radians, x, y, z;
grid_rot.getAngleAxis(&angle_radians, &x, &y, &z);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters();
@@ -416,7 +416,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
}
LLUI::setLineWidth(1.0f);
}
- glPopMatrix();
+ gGL.popMatrix();
}
void LLManip::renderXYZ(const LLVector3 &vec)
@@ -466,11 +466,11 @@ void LLManip::renderXYZ(const LLVector3 &vec)
feedback_string = llformat("X: %.3f", vec.mV[VX]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
- glColor3f(0.5f, 1.f, 0.5f);
+ gGL.diffuseColor3f(0.5f, 1.f, 0.5f);
feedback_string = llformat("Y: %.3f", vec.mV[VY]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
- glColor3f(0.5f, 0.5f, 1.f);
+ gGL.diffuseColor3f(0.5f, 0.5f, 1.f);
feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
}
@@ -481,8 +481,8 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
LLVector3 render_pos = pos;
if (hud_selection)
{
@@ -490,7 +490,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
F32 inv_zoom_amt = 1.f / zoom_amt;
// scale text back up to counter-act zoom level
render_pos = pos * zoom_amt;
- glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+ gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
}
// render shadow first
@@ -501,7 +501,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
gViewerWindow->setup3DViewport();
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
- glPopMatrix();
+ gGL.popMatrix();
}
void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color)
@@ -539,8 +539,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
}
BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
LLVector3 render_pos = pos;
if (hud_selection)
{
@@ -548,7 +548,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
F32 inv_zoom_amt = 1.f / zoom_amt;
// scale text back up to counter-act zoom level
render_pos = pos * zoom_amt;
- glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
+ gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
}
LLColor4 shadow_color = LLColor4::black;
@@ -573,7 +573,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
gViewerWindow->setup3DViewport();
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
}
- glPopMatrix();
+ gGL.popMatrix();
}
LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass)
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 6ee095475f..19798ef752 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -130,12 +130,12 @@ void LLManipRotate::render()
return;
}
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom, zoom, zoom);
+ gGL.scalef(zoom, zoom, zoom);
}
@@ -145,7 +145,7 @@ void LLManipRotate::render()
LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f );
F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
- glPushMatrix();
+ gGL.pushMatrix();
{
// are we in the middle of a constrained drag?
if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z)
@@ -156,11 +156,11 @@ void LLManipRotate::render()
{
LLGLEnable cull_face(GL_CULL_FACE);
LLGLDepthTest gls_depth(GL_FALSE);
- glPushMatrix();
+ gGL.pushMatrix();
{
// Draw "sphere" (intersection of sphere with tangent cone that has apex at camera)
- glTranslatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
- glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+ gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
// Inverse change of basis vectors
LLVector3 forward = mCenterToCamNorm;
@@ -177,14 +177,14 @@ void LLManipRotate::render()
LLMatrix4 mat;
mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f));
- glMultMatrixf( &mat.mMatrix[0][0] );
+ gGL.multMatrix( &mat.mMatrix[0][0] );
- glRotatef( -90, 0.f, 1.f, 0.f);
+ gGL.rotatef( -90, 0.f, 1.f, 0.f);
LLColor4 color;
if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL)
{
color.setVec(0.8f, 0.8f, 0.8f, 0.8f);
- glScalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
+ gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
}
else
{
@@ -202,10 +202,10 @@ void LLManipRotate::render()
GLdouble plane_eqn[] = { 0, 0, 1, 0 };
glClipPlane( GL_CLIP_PLANE0, plane_eqn );
}
- glPopMatrix();
+ gGL.popMatrix();
}
- glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
LLQuaternion rot;
F32 angle_radians, x, y, z;
@@ -217,41 +217,41 @@ void LLManipRotate::render()
LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
if (mManipPart == LL_ROT_Z)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
// selected part
- glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f ));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_Y)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 1.f, 0.f, 0.f );
- glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_X)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 0.f, 1.f, 0.f );
- glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_ROLL)
{
@@ -271,12 +271,12 @@ void LLManipRotate::render()
// First pass: centers. Second pass: sides.
for( S32 i=0; i<2; i++ )
{
- glPushMatrix();
+ gGL.pushMatrix();
{
if (mHighlightedPart == LL_ROT_Z)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
}
@@ -286,15 +286,15 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
+ gGL.popMatrix();
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 1.f, 0.f, 0.f );
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
if (mHighlightedPart == LL_ROT_Y)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
}
@@ -304,15 +304,15 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
+ gGL.popMatrix();
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 0.f, 1.f, 0.f );
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
if (mHighlightedPart == LL_ROT_X)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
@@ -323,7 +323,7 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
+ gGL.popMatrix();
if (mHighlightedPart == LL_ROT_ROLL)
{
@@ -332,8 +332,8 @@ void LLManipRotate::render()
}
}
}
- glPopMatrix();
- glPopMatrix();
+ gGL.popMatrix();
+ gGL.popMatrix();
LLVector3 euler_angles;
LLQuaternion object_rot = first_object->getRotationEdit();
@@ -796,14 +796,14 @@ void LLManipRotate::renderSnapGuides()
for (S32 pass = 0; pass < 3; pass++)
{
// render snap guide ring
- glPushMatrix();
+ gGL.pushMatrix();
LLQuaternion snap_guide_rot;
F32 angle_radians, x, y, z;
snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis());
snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z);
- glTranslatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
LLColor4 line_color = setupSnapGuideRenderPass(pass);
@@ -826,7 +826,7 @@ void LLManipRotate::renderSnapGuides()
{
gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE);
}
- glPopMatrix();
+ gGL.popMatrix();
for (S32 i = 0; i < 64; i++)
{
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 4eb94dfb8e..f6df4cdfbf 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -217,12 +217,12 @@ void LLManipScale::render()
if( canAffectSelection() )
{
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom, zoom, zoom);
+ gGL.scalef(zoom, zoom, zoom);
}
////////////////////////////////////////////////////////////////////////
@@ -274,14 +274,14 @@ void LLManipScale::render()
LLVector3 pos_agent = bbox.getPositionAgent();
LLQuaternion rot = bbox.getRotation();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
{
- glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
+ gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]);
F32 angle_radians, x, y, z;
rot.getAngleAxis(&angle_radians, &x, &y, &z);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
{
@@ -303,13 +303,13 @@ void LLManipScale::render()
glPolygonOffset( 0.f, 0.f);
}
}
- glPopMatrix();
+ gGL.popMatrix();
if (mManipPart != LL_NO_PART)
{
renderSnapGuides(bbox);
}
- glPopMatrix();
+ gGL.popMatrix();
renderXYZ(bbox.getExtentLocal());
}
@@ -719,17 +719,17 @@ void LLManipScale::renderEdges( const LLBBox& bbox )
LLVector3 direction = edgeToUnitVector( part );
LLVector3 center_to_edge = unitVectorToLocalBBoxExtent( direction, bbox );
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] );
+ gGL.translatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] );
conditionalHighlight( part );
- glScalef(
+ gGL.scalef(
direction.mV[0] ? edge_width : extent.mV[VX],
direction.mV[1] ? edge_width : extent.mV[VY],
direction.mV[2] ? edge_width : extent.mV[VZ] );
gBox.render();
}
- glPopMatrix();
+ gGL.popMatrix();
}
}
@@ -766,13 +766,13 @@ void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z )
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLDepthTest gls_depth(GL_FALSE);
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef( x, y, z );
- glScalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
+ gGL.translatef( x, y, z );
+ gGL.scalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize );
gBox.render();
}
- glPopMatrix();
+ gGL.popMatrix();
}
@@ -788,16 +788,16 @@ void LLManipScale::renderAxisHandle( const LLVector3& start, const LLVector3& en
LLVector3 delta = end - offset_start;
LLVector3 pos = offset_start + 0.5f * delta;
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
- glScalef(
+ gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
+ gGL.scalef(
mBoxHandleSize + llabs(delta.mV[VX]),
mBoxHandleSize + llabs(delta.mV[VY]),
mBoxHandleSize + llabs(delta.mV[VZ]));
gBox.render();
}
- glPopMatrix();
+ gGL.popMatrix();
}
else
{
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index f871df0c36..3a88fbd96d 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1066,12 +1066,12 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
void LLManipTranslate::render()
{
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom, zoom, zoom);
+ gGL.scalef(zoom, zoom, zoom);
}
{
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
@@ -1515,11 +1515,12 @@ void LLManipTranslate::renderSnapGuides()
F32 x,y,z,angle_radians;
grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
F32 sz = mGridSizeMeters;
F32 tiles = sz;
- glMatrixMode(GL_TEXTURE);
+
+ gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.pushMatrix();
usc = 1.0f/usc;
vsc = 1.0f/vsc;
@@ -1533,7 +1534,7 @@ void LLManipTranslate::renderSnapGuides()
vsc *= 0.5f;
}
- glScalef(usc, vsc, 1.0f);
+ gGL.scalef(usc, vsc, 1.0f);
gGL.translatef(u, v, 0);
float a = line_alpha;
@@ -1566,7 +1567,7 @@ void LLManipTranslate::renderSnapGuides()
renderGrid(u,v,tiles,1,1,1,a);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
@@ -1665,7 +1666,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
glStencilFunc(GL_ALWAYS, 0, stencil_mask);
gGL.setColorMask(false, false);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glColor4f(1,1,1,1);
+ gGL.diffuseColor4f(1,1,1,1);
//setup clip plane
normal = normal * grid_rotation;
@@ -1723,7 +1724,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
F32 x,y,z,angle_radians;
grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
F32 sz = mGridSizeMeters;
F32 tiles = sz;
@@ -1852,7 +1853,7 @@ void LLManipTranslate::renderTranslationHandles()
mGridSizeMeters = gSavedSettings.getF32("GridDrawSize");
mConeSize = mArrowLengthMeters / 4.f;
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
{
gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]);
@@ -1860,7 +1861,7 @@ void LLManipTranslate::renderTranslationHandles()
F32 angle_radians, x, y, z;
grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
LLQuaternion invRotation = grid_rotation;
invRotation.conjQuat();
@@ -1908,9 +1909,9 @@ void LLManipTranslate::renderTranslationHandles()
{
// render YZ plane manipulator
gGL.pushMatrix();
- glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
gGL.translatef(0.f, mPlaneManipOffsetMeters, mPlaneManipOffsetMeters);
- glScalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
+ gGL.scalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]);
if (mHighlightedPart == LL_YZ_PLANE)
{
color1.setVec(0.f, 1.f, 0.f, 1.f);
@@ -1962,9 +1963,9 @@ void LLManipTranslate::renderTranslationHandles()
{
// render XZ plane manipulator
gGL.pushMatrix();
- glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
gGL.translatef(mPlaneManipOffsetMeters, 0.f, mPlaneManipOffsetMeters);
- glScalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
+ gGL.scalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]);
if (mHighlightedPart == LL_XZ_PLANE)
{
color1.setVec(0.f, 0.f, 1.f, 1.f);
@@ -2018,7 +2019,7 @@ void LLManipTranslate::renderTranslationHandles()
{
// render XY plane manipulator
gGL.pushMatrix();
- glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
+ gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]);
/* Y
^
@@ -2043,7 +2044,7 @@ void LLManipTranslate::renderTranslationHandles()
v2 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
v3 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f);
#endif
- glScalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
+ gGL.scalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]);
if (mHighlightedPart == LL_XY_PLANE)
{
color1.setVec(1.f, 0.f, 0.f, 1.f);
@@ -2215,7 +2216,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_
}
gGL.translatef(vec.mV[0], vec.mV[1], vec.mV[2]);
- glScalef(handle_size, handle_size, handle_size);
+ gGL.scalef(handle_size, handle_size, handle_size);
F32 rot = 0.0f;
LLVector3 axis;
@@ -2239,11 +2240,11 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_
break;
}
- glColor4fv(color.mV);
- glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
- glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
+ gGL.diffuseColor4fv(color.mV);
+ gGL.rotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]);
+ gGL.scalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f);
- gCone.render(CONE_LOD_HIGHEST);
+ gCone.render();
gGL.popMatrix();
}
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 5fe5c9b1e8..15d5d7c162 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -172,10 +172,10 @@ void LLNetMap::draw()
LLVector3 offset = gGL.getUITranslation();
LLVector3 scale = gGL.getUIScale();
- glLoadIdentity();
+ gGL.loadIdentity();
gGL.loadUIIdentity();
- glScalef(scale.mV[0], scale.mV[1], scale.mV[2]);
+ gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
{
@@ -183,7 +183,7 @@ void LLNetMap::draw()
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// Draw background rectangle
LLColor4 background_color = mBackgroundColor.get();
@@ -204,7 +204,7 @@ void LLNetMap::draw()
{
// rotate subsequent draws to agent rotation
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
- glRotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
+ gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
}
// figure out where agent is
@@ -492,7 +492,7 @@ void LLNetMap::draw()
// If we don't rotate the map, we have to rotate the frustum.
gGL.pushMatrix();
gGL.translatef( ctr_x, ctr_y, 0 );
- glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
+ gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
gGL.begin( LLRender::TRIANGLES );
gGL.vertex2f( 0, 0 );
gGL.vertex2f( -half_width_pixels, far_clip_pixels );
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index db7d836799..a637ff156c 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -287,15 +287,15 @@ LLPanelLogin::~LLPanelLogin()
// virtual
void LLPanelLogin::draw()
{
- glPushMatrix();
+ gGL.pushMatrix();
{
F32 image_aspect = 1.333333f;
F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight();
// stretch image to maintain aspect ratio
if (image_aspect > view_aspect)
{
- glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
- glScalef(image_aspect / view_aspect, 1.f, 1.f);
+ gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
+ gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
}
S32 width = getRect().getWidth();
@@ -310,7 +310,7 @@ void LLPanelLogin::draw()
mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight());
};
}
- glPopMatrix();
+ gGL.popMatrix();
LLPanel::draw();
}
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 18d6731fcb..3ff5a05d81 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -169,7 +169,7 @@ void LLPreviewTexture::draw()
saveAs();
}
// Draw the texture
- glColor3f( 1.f, 1.f, 1.f );
+ gGL.diffuseColor3f( 1.f, 1.f, 1.f );
gl_draw_scaled_image(interior.mLeft,
interior.mBottom,
interior.getWidth(),
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index a1f38f1854..5d7a5b1c59 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -187,7 +187,7 @@ void LLProgressView::setVisible(BOOL visible)
void LLProgressView::drawStartTexture(F32 alpha)
{
- glPushMatrix();
+ gGL.pushMatrix();
if (gStartTexture)
{
LLGLSUIDefault gls_ui;
@@ -200,13 +200,13 @@ void LLProgressView::drawStartTexture(F32 alpha)
// stretch image to maintain aspect ratio
if (image_aspect > view_aspect)
{
- glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
- glScalef(image_aspect / view_aspect, 1.f, 1.f);
+ gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f);
+ gGL.scalef(image_aspect / view_aspect, 1.f, 1.f);
}
else
{
- glTranslatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
- glScalef(1.f, view_aspect / image_aspect, 1.f);
+ gGL.translatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f);
+ gGL.scalef(1.f, view_aspect / image_aspect, 1.f);
}
gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -217,7 +217,7 @@ void LLProgressView::drawStartTexture(F32 alpha)
gGL.color4f(0.f, 0.f, 0.f, 1.f);
gl_rect_2d(getRect());
}
- glPopMatrix();
+ gGL.popMatrix();
}
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 26b2b0f5c3..76d6954a88 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -89,6 +89,7 @@
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "pipeline.h"
+#include "llviewershadermgr.h"
#include "llglheaders.h"
@@ -5133,20 +5134,20 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
F32 cur_zoom = gAgentCamera.mHUDCurZoom;
// set up transform to encompass bounding box of HUD
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
- glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+ gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.pushUIMatrix();
gGL.loadUIIdentity();
- glLoadIdentity();
- glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
- glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
- glScalef(cur_zoom, cur_zoom, cur_zoom);
+ gGL.loadIdentity();
+ gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
+ gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+ gGL.scalef(cur_zoom, cur_zoom, cur_zoom);
}
if (mSelectedObjects->getNumNodes())
{
@@ -5239,10 +5240,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
if (isAgentAvatarValid() && for_hud)
{
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
gGL.popUIMatrix();
stop_glerror();
@@ -5566,12 +5567,11 @@ void pushWireframe(LLDrawable* drawable)
{
LLVertexBuffer::unbind();
gGL.pushMatrix();
- glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
+ gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i)
{
const LLVolumeFace& face = rigged_volume->getVolumeFace(i);
- glVertexPointer(3, GL_FLOAT, 16, face.mPositions);
- glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, face.mTexCoords, face.mNumIndices, face.mIndices);
}
gGL.popMatrix();
}
@@ -5584,7 +5584,7 @@ void pushWireframe(LLDrawable* drawable)
LLFace* face = drawable->getFace(i);
if (face->verify())
{
- pushVerts(face, LLVertexBuffer::MAP_VERTEX);
+ pushVerts(face, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0);
}
}
}
@@ -5604,22 +5604,29 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
return;
}
- glMatrixMode(GL_MODELVIEW);
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+
+ if (shader)
+ {
+ gHighlightProgram.bind();
+ }
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
BOOL is_hud_object = objectp->isHUDAttachment();
if (drawable->isActive())
{
- glLoadMatrixd(gGLModelView);
- glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
+ gGL.loadMatrix(gGLModelView);
+ gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
}
else if (!is_hud_object)
{
- glLoadIdentity();
- glMultMatrixd(gGLModelView);
+ gGL.loadIdentity();
+ gGL.multMatrix(gGLModelView);
LLVector3 trans = objectp->getRegion()->getOriginAgent();
- glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
}
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -5627,26 +5634,35 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
{
gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
- LLGLEnable fog(GL_FOG);
- glFogi(GL_FOG_MODE, GL_LINEAR);
- float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
- LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
- glFogf(GL_FOG_START, d);
- glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
- glFogfv(GL_FOG_COLOR, fogCol.mV);
-
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ if (shader)
{
- glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+ gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
pushWireframe(drawable);
}
+ else
+ {
+ LLGLEnable fog(GL_FOG);
+ glFogi(GL_FOG_MODE, GL_LINEAR);
+ float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
+ LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
+ glFogf(GL_FOG_START, d);
+ glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV())));
+ glFogfv(GL_FOG_COLOR, fogCol.mV);
+
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ {
+ gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+ pushWireframe(drawable);
+ }
+ }
}
gGL.flush();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+ gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(3.f, 3.f);
glLineWidth(3.f);
@@ -5654,6 +5670,11 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color)
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
gGL.popMatrix();
+
+ if (shader)
+ {
+ shader->bind();
+ }
}
//-----------------------------------------------------------------------------
@@ -5692,21 +5713,21 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
return;
}
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.pushUIMatrix();
gGL.loadUIIdentity();
if (!is_hud_object)
{
- glLoadIdentity();
- glMultMatrixd(gGLModelView);
+ gGL.loadIdentity();
+ gGL.multMatrix(gGLModelView);
}
if (drawable->isActive())
{
- glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
+ gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix);
}
LLVolume *volume = objectp->getVolume();
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index fd17781a2e..81d7fe70c1 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2416,7 +2416,7 @@ void pushVerts(LLFace* face, U32 mask)
LLVertexBuffer* buffer = face->getVertexBuffer();
- if (buffer)
+ if (buffer && (face->getGeomCount() >= 3))
{
buffer->setBuffer(mask);
U16 start = face->getGeomStart();
@@ -2441,8 +2441,7 @@ void pushVerts(LLVolume* volume)
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
{
const LLVolumeFace& face = volume->getVolumeFace(i);
- glVertexPointer(3, GL_FLOAT, 16, face.mPositions);
- glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
}
}
@@ -2508,7 +2507,7 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
{
params = *j;
LLRenderPass::applyModelMatrix(*params);
- glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
+ gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
params->mVertexBuffer->setBuffer(mask);
params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES,
params->mStart, params->mEnd, params->mCount, params->mOffset);
@@ -2553,9 +2552,9 @@ void renderOctree(LLSpatialGroup* group)
LLDrawable* drawable = *i;
if (!group->mSpatialPartition->isBridge())
{
- glPushMatrix();
+ gGL.pushMatrix();
LLVector3 trans = drawable->getRegion()->getOriginAgent();
- glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
}
for (S32 j = 0; j < drawable->getNumFaces(); j++)
@@ -2565,11 +2564,11 @@ void renderOctree(LLSpatialGroup* group)
{
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
{
- glColor4f(0, 1, 0, group->mBuilt);
+ gGL.diffuseColor4f(0, 1, 0, group->mBuilt);
}
else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f)
{
- glColor4f(1, 0, 0, group->mBuilt);
+ gGL.diffuseColor4f(1, 0, 0, group->mBuilt);
}
else
{
@@ -2585,7 +2584,7 @@ void renderOctree(LLSpatialGroup* group)
if (!group->mSpatialPartition->isBridge())
{
- glPopMatrix();
+ gGL.popMatrix();
}
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -2666,7 +2665,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
LLGLDepthTest depth_under(GL_TRUE, GL_FALSE, GL_GREATER);
- glColor4f(0, 0.5f, 0, 0.5f);
+ gGL.diffuseColor4f(0, 0.5f, 0, 0.5f);
gGL.color4f(0, 0.5f, 0, 0.5f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2676,7 +2675,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
- glColor4f(0.f, 0.5f, 0.f,1.f);
+ gGL.diffuseColor4f(0.f, 0.5f, 0.f,1.f);
gGL.color4f(0.f, 0.5f, 0.f, 1.f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2685,7 +2684,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
if (render_objects)
{
- glColor4f(0.f, 0.75f, 0.f,0.5f);
+ gGL.diffuseColor4f(0.f, 0.75f, 0.f,0.5f);
gGL.color4f(0.f, 0.75f, 0.f, 0.5f);
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
}
@@ -2694,11 +2693,11 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
LLVertexBuffer::unbind();
group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
- glColor4f(1.0f, 0.f, 0.f, 0.5f);
+ gGL.diffuseColor4f(1.0f, 0.f, 0.f, 0.5f);
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4f(1.0f, 1.f, 1.f, 1.0f);
+ gGL.diffuseColor4f(1.0f, 1.f, 1.f, 1.0f);
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}*/
@@ -2731,23 +2730,23 @@ void renderUpdateType(LLDrawable* drawablep)
switch (vobj->getLastUpdateType())
{
case OUT_FULL:
- glColor4f(0,1,0,0.5f);
+ gGL.diffuseColor4f(0,1,0,0.5f);
break;
case OUT_TERSE_IMPROVED:
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
break;
case OUT_FULL_COMPRESSED:
if (vobj->getLastUpdateCached())
{
- glColor4f(1,0,0,0.5f);
+ gGL.diffuseColor4f(1,0,0,0.5f);
}
else
{
- glColor4f(1,1,0,0.5f);
+ gGL.diffuseColor4f(1,1,0,0.5f);
}
break;
case OUT_FULL_CACHED:
- glColor4f(0,0,1,0.5f);
+ gGL.diffuseColor4f(0,0,1,0.5f);
break;
default:
llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl;
@@ -2867,7 +2866,7 @@ void renderNormals(LLDrawable* drawablep)
{
LLVolume* volume = vol->getVolume();
gGL.pushMatrix();
- glMultMatrixf((F32*) vol->getRelativeXform().mMatrix);
+ gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -2877,10 +2876,9 @@ void renderNormals(LLDrawable* drawablep)
{
const LLVolumeFace& face = volume->getVolumeFace(i);
- gGL.begin(LLRender::LINES);
-
for (S32 j = 0; j < face.mNumVertices; ++j)
{
+ gGL.begin(LLRender::LINES);
LLVector4a n,p;
n.setMul(face.mNormals[j], scale);
@@ -2899,9 +2897,8 @@ void renderNormals(LLDrawable* drawablep)
gGL.vertex3fv(face.mPositions[j].getF32ptr());
gGL.vertex3fv(p.getF32ptr());
}
+ gGL.end();
}
-
- gGL.end();
}
gGL.popMatrix();
@@ -2941,13 +2938,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
{
if (!decomp->mBaseHullMesh.empty())
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions, decomp->mBaseHullMesh.mNormals);
}
else
{
gMeshRepo.buildPhysicsMesh(*decomp);
- gGL.color3f(0,1,1);
+ gGL.diffuseColor4f(0,1,1,1);
drawBoxOutline(center, size);
}
@@ -2961,13 +2958,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo
void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color)
{
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glPolygonOffset(3.f, 3.f);
glLineWidth(3.f);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals);
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3021,7 +3018,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
LLVector3 size(0.25f,0.25f,0.25f);
gGL.pushMatrix();
- glMultMatrixf((F32*) volume->getRelativeXform().mMatrix);
+ gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix);
if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH)
{
@@ -3049,11 +3046,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
else if (!decomp->mPhysicsShapeMesh.empty())
{
//decomp has physics mesh, render that mesh
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions, decomp->mPhysicsShapeMesh.mNormals);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
@@ -3081,7 +3078,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
{
renderMeshBaseHull(volume, data_mask, color, line_color);
}
-#if LL_WINDOWS
else
{
LLVolumeParams volume_params = volume->getVolume()->getParams();
@@ -3179,27 +3175,26 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::unbind();
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
-
- glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
- glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+ LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
+
}
else
{
- gGL.color3f(1,0,1);
+ gGL.diffuseColor4f(1,0,1,1);
drawBoxOutline(center, size);
}
LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
}
-#endif //LL_WINDOWS
}
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX)
{
@@ -3213,7 +3208,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
}
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE)
{
- LLVolumeParams volume_params;
+ /*LLVolumeParams volume_params;
volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE );
volume_params.setBeginAndEndS( 0.f, 1.f );
volume_params.setBeginAndEndT( 0.f, 1.f );
@@ -3221,9 +3216,9 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
volume_params.setShear ( 0, 0 );
LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
pushVerts(sphere);
- LLPrimitive::sVolumeManager->unrefVolume(sphere);
+ LLPrimitive::sVolumeManager->unrefVolume(sphere);*/
}
else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER)
{
@@ -3235,7 +3230,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
volume_params.setShear ( 0, 0 );
LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
pushVerts(cylinder);
LLPrimitive::sVolumeManager->unrefVolume(cylinder);
}
@@ -3247,10 +3242,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
pushVerts(phys_volume);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
pushVerts(phys_volume);
LLPrimitive::sVolumeManager->unrefVolume(phys_volume);
@@ -3268,10 +3263,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
LLVertexBuffer::unbind();
glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
- glColor4fv(line_color.mV);
+ gGL.diffuseColor4fv(line_color.mV);
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
}
@@ -3293,15 +3289,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
}
gGL.popMatrix();
-
- /*{ //analytical shape, just push visual rep.
- glColor3fv(color.mV);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- pushVerts(drawable, data_mask);
- glColor4fv(color.mV);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- pushVerts(drawable, data_mask);
- }*/
}
void renderPhysicsShapes(LLSpatialGroup* group)
@@ -3316,7 +3303,7 @@ void renderPhysicsShapes(LLSpatialGroup* group)
{
gGL.pushMatrix();
LLVector3 trans = drawable->getRegion()->getOriginAgent();
- glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
renderPhysicsShape(drawable, volume);
gGL.popMatrix();
}
@@ -3340,10 +3327,10 @@ void renderPhysicsShapes(LLSpatialGroup* group)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
- glColor3f(0.2f, 0.5f, 0.3f);
+ gGL.diffuseColor3f(0.2f, 0.5f, 0.3f);
buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
- glColor3f(0.2f, 1.f, 0.3f);
+ gGL.diffuseColor3f(0.2f, 1.f, 0.3f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
buff->draw(LLRender::TRIANGLES, buff->getRequestedIndices(), 0);
}
@@ -3435,7 +3422,7 @@ void renderTextureAnim(LLDrawInfo* params)
}
LLGLEnable blend(GL_BLEND);
- glColor4f(1,1,0,0.5f);
+ gGL.diffuseColor4f(1,1,0,0.5f);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
@@ -3461,22 +3448,22 @@ void renderShadowFrusta(LLDrawInfo* params)
if (gPipeline.mShadowCamera[4].AABBInFrustum(center, size))
{
- glColor3f(1,0,0);
+ gGL.diffuseColor3f(1,0,0);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[5].AABBInFrustum(center, size))
{
- glColor3f(0,1,0);
+ gGL.diffuseColor3f(0,1,0);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[6].AABBInFrustum(center, size))
{
- glColor3f(0,0,1);
+ gGL.diffuseColor3f(0,0,1);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
if (gPipeline.mShadowCamera[7].AABBInFrustum(center, size))
{
- glColor3f(1,0,1);
+ gGL.diffuseColor3f(1,0,1);
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
}
@@ -3494,7 +3481,7 @@ void renderLights(LLDrawable* drawablep)
if (drawablep->getNumFaces())
{
LLGLEnable blend(GL_BLEND);
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
{
@@ -3632,8 +3619,8 @@ void renderRaycast(LLDrawable* drawablep)
}
gGL.pushMatrix();
- glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]);
- glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
+ gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]);
+ gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix);
LLVector3 start, end;
if (transform)
@@ -3662,8 +3649,9 @@ void renderRaycast(LLDrawable* drawablep)
{
//render face positions
LLVertexBuffer::unbind();
- glColor4f(0,1,1,0.5f);
+ gGL.diffuseColor4f(0,1,1,0.5f);
glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
}
@@ -3686,15 +3674,15 @@ void renderRaycast(LLDrawable* drawablep)
if (drawablep->getVObj() == gDebugRaycastObject)
{
// draw intersection point
- glPushMatrix();
- glLoadMatrixd(gGLModelView);
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLModelView);
LLVector3 translate = gDebugRaycastIntersection;
- glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]);
+ gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]);
LLCoordFrame orient;
orient.lookDir(gDebugRaycastNormal, gDebugRaycastBinormal);
LLMatrix4 rotation;
orient.getRotMatrixToParent(rotation);
- glMultMatrixf((float*)rotation.mMatrix);
+ gGL.multMatrix((float*)rotation.mMatrix);
gGL.color4f(1,0,0,0.5f);
drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f));
@@ -3702,7 +3690,7 @@ void renderRaycast(LLDrawable* drawablep)
drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f));
gGL.color4f(0,0,1,0.5f);
drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f));
- glPopMatrix();
+ gGL.popMatrix();
// draw bounding box of prim
const LLVector4a* ext = drawablep->getSpatialExtents();
@@ -3777,13 +3765,13 @@ public:
group->rebuildMesh();
gGL.flush();
- glPushMatrix();
+ gGL.pushMatrix();
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
renderVisibility(group, mCamera);
stop_glerror();
gGLLastMatrix = NULL;
- glPopMatrix();
+ gGL.popMatrix();
gGL.color4f(1,1,1,1);
}
}
@@ -4120,6 +4108,11 @@ void LLSpatialPartition::renderDebug()
return;
}
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
{
//sLastMaxTexPriority = lerp(sLastMaxTexPriority, sCurMaxTexPriority, gFrameIntervalSeconds);
@@ -4148,6 +4141,11 @@ void LLSpatialPartition::renderDebug()
LLOctreeRenderNonOccluded render_debug(camera);
render_debug.traverse(mOctree);
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
}
void LLSpatialGroup::drawObjectBox(LLColor4 col)
@@ -4257,7 +4255,7 @@ public:
LLVector3 local_start = mStart;
LLVector3 local_end = mEnd;
- if (!gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
+ if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible())
{
return false;
}
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 11955540c6..f0c8a372ee 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -93,7 +93,6 @@ public:
LLPointer<LLViewerTexture> mTexture;
std::vector<LLPointer<LLViewerTexture> > mTextureList;
- LLColor4U mGlowColor;
S32 mDebugColor;
const LLMatrix4* mTextureMatrix;
const LLMatrix4* mModelMatrix;
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index e8abee2fb7..e2c2b2ae21 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -216,22 +216,22 @@ void LLTexLayerSetBuffer::cancelUpload()
void LLTexLayerSetBuffer::pushProjection() const
{
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
}
void LLTexLayerSetBuffer::popProjection() const
{
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
@@ -295,6 +295,8 @@ BOOL LLTexLayerSetBuffer::render()
BOOL success = TRUE;
+ LLVertexBuffer::unbind();
+
//hack to use fixed function when updating tex layer sets
bool no_ff = LLGLSLShader::sNoFixedFunction;
LLGLSLShader::sNoFixedFunction = false;
@@ -304,8 +306,6 @@ BOOL LLTexLayerSetBuffer::render()
success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
gGL.flush();
- LLGLSLShader::sNoFixedFunction = no_ff;
-
if(upload_now)
{
if (!success)
@@ -335,6 +335,9 @@ BOOL LLTexLayerSetBuffer::render()
doUpdate();
}
+ LLVertexBuffer::unbind();
+ LLGLSLShader::sNoFixedFunction = no_ff;
+
// reset GL state
gGL.setColorMask(true, true);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 0115115a23..f4b01a6bab 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -571,7 +571,7 @@ void LLGLTexMemBar::draw()
color = (total_mem < llfloor(max_total_mem * texmem_lower_bound_scale)) ? LLColor4::green :
(total_mem < max_total_mem) ? LLColor4::yellow : LLColor4::red;
color[VALPHA] = .75f;
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
gl_rect_2d(left, top, right, bottom); // red/yellow/green
@@ -594,7 +594,7 @@ void LLGLTexMemBar::draw()
color = (bound_mem < llfloor(max_bound_mem * texmem_lower_bound_scale)) ? LLColor4::green :
(bound_mem < max_bound_mem) ? LLColor4::yellow : LLColor4::red;
color[VALPHA] = .75f;
- glColor4fv(color.mV);
+ gGL.diffuseColor4fv(color.mV);
gl_rect_2d(left, top, right, bottom);
#else
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 9782b90cf1..aba43a9715 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -507,12 +507,12 @@ void LLToolBrushLand::render()
void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region,
const LLVector3& pos_world)
{
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLDepthTest mDepthTest(GL_TRUE);
- glPushMatrix();
+ gGL.pushMatrix();
gGL.color4fv(OVERLAY_COLOR.mV);
- glTranslatef(0.0f, 0.0f, 1.0f);
+ gGL.translatef(0.0f, 0.0f, 1.0f);
S32 i = (S32) pos_region.mV[VX];
S32 j = (S32) pos_region.mV[VY];
@@ -566,7 +566,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region
}
gGL.end();
- glPopMatrix();
+ gGL.popMatrix();
}
void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 964b17d3a6..718201e381 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -169,23 +169,28 @@ BOOL LLVisualParamHint::render()
gGL.pushUIMatrix();
gGL.loadUIIdentity();
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
- glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
LLGLSUIDefault gls_ui;
//LLGLState::verify(TRUE);
mBackgroundp->draw(0, 0, mFullWidth, mFullHeight);
- glMatrixMode(GL_PROJECTION);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
mNeedsUpdate = FALSE;
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 983108391f..bec05bd3d2 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -505,9 +505,10 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ {
+ gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color);
@@ -559,9 +560,8 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
gGL.end();
}
-
- //gCylinder.render(1000);
- glPopMatrix();
+ }
+ gGL.popMatrix();
std::string text;
text = llformat( "%.0f m", to_vec.magVec());
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 7f7366dd3d..c0ef4da1ff 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -325,8 +325,8 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
aspect = getAspect();
// Load camera view matrix
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadIdentity();
glh::matrix4f proj_mat;
@@ -385,14 +385,14 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far);
- glLoadMatrixf(proj_mat.m);
+ gGL.loadMatrix(proj_mat.m);
for (U32 i = 0; i < 16; i++)
{
gGLProjection[i] = proj_mat.m[i];
}
- glMatrixMode( GL_MODELVIEW );
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION);
@@ -402,7 +402,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
modelview *= glh::matrix4f(ogl_matrix);
- glLoadMatrixf(modelview.m);
+ gGL.loadMatrix(modelview.m);
if (for_selection && (width > 1 || height > 1))
{
@@ -431,10 +431,10 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
/*if (gSavedSettings.getBOOL("CameraOffset"))
{
- glMatrixMode(GL_PROJECTION);
- glTranslatef(0,0,-50);
- glRotatef(20.0,1,0,0);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.translatef(0,0,-50);
+ gGL.rotatef(20.0,1,0,0);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}*/
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 6142ee0dd6..5f4156732e 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -701,10 +701,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
glh_set_current_projection(proj);
glh_set_current_modelview(mod);
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(proj.m);
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(mod.m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(mod.m);
gViewerWindow->setup3DViewport();
LLGLState::checkStates();
@@ -724,6 +724,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery");
gPipeline.generateWaterReflection(*LLViewerCamera::getInstance());
gPipeline.generateHighlight(*LLViewerCamera::getInstance());
+ gPipeline.renderPhysicsDisplay();
}
LLGLState::checkStates();
@@ -812,13 +813,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
//// assumes frontmost floater with focus is opaque
//if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp))
//{
- // glMatrixMode(GL_MODELVIEW);
- // glPushMatrix();
+ // gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // gGL.pushMatrix();
// {
// gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
- // glLoadIdentity();
+ // gGL.loadIdentity();
// LLRect floater_rect = frontmost_floaterp->calcScreenRect();
// // deflate by one pixel so rounding errors don't occlude outside of floater extents
@@ -828,8 +829,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
// (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(),
// (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled());
// floater_3d_rect.translate(-0.5f, -0.5f);
- // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
- // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
+ // gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
+ // gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
// gGL.color4fv(LLColor4::white.mV);
// gGL.begin(LLVertexBuffer::QUADS);
// {
@@ -841,7 +842,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
// gGL.end();
// glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// }
- // glPopMatrix();
+ // gGL.popMatrix();
//}
LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
@@ -978,10 +979,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
void render_hud_attachments()
{
LLMemType mt_ra(LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
glh::matrix4f current_proj = glh_get_current_projection();
glh::matrix4f current_mod = glh_get_current_modelview();
@@ -1067,10 +1068,10 @@ void render_hud_attachments()
}
LLPipeline::sUseOcclusion = use_occlusion;
}
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
glh_set_current_projection(current_proj);
glh_set_current_modelview(current_mod);
@@ -1153,12 +1154,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region)
if (!result) return result;
// set up transform to keep HUD objects in front of camera
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(proj.m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj.m);
glh_set_current_projection(proj);
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(model.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadMatrix(model.m);
glh_set_current_modelview(model);
return TRUE;
}
@@ -1174,8 +1175,8 @@ void render_ui(F32 zoom_factor, int subfield)
if (!gSnapshot)
{
- glPushMatrix();
- glLoadMatrixd(gGLLastModelView);
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLLastModelView);
glh_set_current_modelview(glh_copy_matrix(gGLLastModelView));
}
@@ -1231,7 +1232,7 @@ void render_ui(F32 zoom_factor, int subfield)
if (!gSnapshot)
{
glh_set_current_modelview(saved_view);
- glPopMatrix();
+ gGL.popMatrix();
}
if (gDisplaySwapBuffers)
@@ -1304,10 +1305,10 @@ void draw_axes()
gGL.vertex3f(0.0f, 0.0f, 40.0f);
gGL.end();
// Some coordinate axes
- glPushMatrix();
- glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
+ gGL.pushMatrix();
+ gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] );
renderCoordinateAxes();
- glPopMatrix();
+ gGL.popMatrix();
}
void render_ui_3d()
@@ -1377,10 +1378,10 @@ void render_ui_2d()
gGL.pushMatrix();
S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
- glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
- glTranslatef((F32)half_width, (F32)half_height, 0.f);
+ gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
+ gGL.translatef((F32)half_width, (F32)half_height, 0.f);
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom,zoom,1.f);
+ gGL.scalef(zoom,zoom,1.f);
gGL.color4fv(LLColor4::white.mV);
gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE);
gGL.popMatrix();
@@ -1459,6 +1460,11 @@ void render_ui_2d()
void render_disconnected_background()
{
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
gGL.color4f(1,1,1,1);
if (!gDisconnectedImagep && gDisconnected)
{
@@ -1512,22 +1518,28 @@ void render_disconnected_background()
{
LLGLSUIDefault gls_ui;
gViewerWindow->setup2DRender();
- glPushMatrix();
+ gGL.pushMatrix();
{
// scale ui to reflect UIScaleFactor
// this can't be done in setup2DRender because it requires a
// pushMatrix/popMatrix pair
const LLVector2& display_scale = gViewerWindow->getDisplayScale();
- glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
+ gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
gGL.getTexUnit(0)->bind(gDisconnectedImagep);
gGL.color4f(1.f, 1.f, 1.f, 1.f);
gl_rect_2d_simple_tex(width, height);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
- glPopMatrix();
+ gGL.popMatrix();
}
gGL.flush();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
+
}
void display_cleanup()
diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp
index baf85d6884..f2e49ff270 100644
--- a/indra/newview/llviewerjoint.cpp
+++ b/indra/newview/llviewerjoint.cpp
@@ -126,7 +126,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
// //----------------------------------------------------------------
// // push matrix stack
// //----------------------------------------------------------------
-// glPushMatrix();
+// gGL.pushMatrix();
// //----------------------------------------------------------------
// // render the bone to my parent
@@ -140,8 +140,8 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
// // offset to joint position and
// // rotate to our orientation
// //----------------------------------------------------------------
-// glLoadIdentity();
-// glMultMatrixf( &getWorldMatrix().mMatrix[0][0] );
+// gGL.loadIdentity();
+// gGL.multMatrix( &getWorldMatrix().mMatrix[0][0] );
// //----------------------------------------------------------------
// // render joint axes
@@ -233,7 +233,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
// //----------------------------------------------------------------
// // pop matrix stack
// //----------------------------------------------------------------
-// glPopMatrix();
+// gGL.popMatrix();
// }
@@ -346,7 +346,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
// F32 boneSize = 0.02f;
// // rotate to point to child (bone direction)
-// glPushMatrix();
+// gGL.pushMatrix();
// LLVector3 boneX = getPosition();
// F32 length = boneX.normVec();
@@ -362,7 +362,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
// rotateMat.setFwdRow( boneX );
// rotateMat.setLeftRow( boneY );
// rotateMat.setUpRow( boneZ );
-// glMultMatrixf( &rotateMat.mMatrix[0][0] );
+// gGL.multMatrix( &rotateMat.mMatrix[0][0] );
// // render the bone
// gGL.color3f( 0.5f, 0.5f, 0.0f );
@@ -388,7 +388,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
// gGL.end();
// // restore matrix
-// glPopMatrix();
+// gGL.popMatrix();
// }
//--------------------------------------------------------------------
@@ -541,7 +541,7 @@ void LLViewerJointCollisionVolume::renderCollision()
updateWorldMatrix();
gGL.pushMatrix();
- glMultMatrixf( &mXform.getWorldMatrix().mMatrix[0][0] );
+ gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
gGL.color3f( 0.f, 0.f, 1.f );
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 77c8bb0329..20ee475939 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -459,7 +459,10 @@ void LLViewerJointMesh::uploadJointMatrices()
}
}
stop_glerror();
- glUniform4fvARB(gAvatarMatrixParam, 45, mat);
+ if (LLGLSLShader::sCurBoundShaderPtr)
+ {
+ LLGLSLShader::sCurBoundShaderPtr->uniform4fv(LLViewerShaderMgr::AVATAR_MATRIX, 45, mat);
+ }
stop_glerror();
}
else
@@ -512,7 +515,8 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
if (!mValid || !mMesh || !mFace || !mVisible ||
!mFace->getVertexBuffer() ||
- mMesh->getNumFaces() == 0)
+ mMesh->getNumFaces() == 0 ||
+ (LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShaderPtr == NULL))
{
return 0;
}
@@ -527,9 +531,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
// setup current color
//----------------------------------------------------------------
if (is_dummy)
- glColor4fv(LLVOAvatar::getDummyColor().mV);
+ gGL.diffuseColor4fv(LLVOAvatar::getDummyColor().mV);
else
- glColor4fv(mColor.mV);
+ gGL.diffuseColor4fv(mColor.mV);
stop_glerror();
@@ -547,11 +551,11 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
if (mIsTransparent)
{
- glColor4f(1.f, 1.f, 1.f, 1.f);
+ gGL.diffuseColor4f(1.f, 1.f, 1.f, 1.f);
}
else
{
- glColor4f(0.7f, 0.6f, 0.3f, 1.f);
+ gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f);
gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
}
}
@@ -582,13 +586,16 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
}
- mFace->getVertexBuffer()->setBuffer(sRenderMask);
+
+ U32 mask = sRenderMask;
U32 start = mMesh->mFaceVertexOffset;
U32 end = start + mMesh->mFaceVertexCount - 1;
U32 count = mMesh->mFaceIndexCount;
U32 offset = mMesh->mFaceIndexOffset;
+ LLVertexBuffer* buff = mFace->getVertexBuffer();
+
if (mMesh->hasWeights())
{
if ((mFace->getPool()->getVertexShaderLevel() > 0))
@@ -597,17 +604,24 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
uploadJointMatrices();
}
+ mask = mask | LLVertexBuffer::MAP_WEIGHT;
+ if (mFace->getPool()->getVertexShaderLevel() > 1)
+ {
+ mask = mask | LLVertexBuffer::MAP_CLOTHWEIGHT;
+ }
}
- mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ buff->setBuffer(mask);
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
}
else
{
- glPushMatrix();
+ gGL.pushMatrix();
LLMatrix4 jointToWorld = getWorldMatrix();
- glMultMatrixf((GLfloat*)jointToWorld.mMatrix);
- mFace->getVertexBuffer()->drawRange(LLRender::TRIANGLES, start, end, count, offset);
- glPopMatrix();
+ gGL.multMatrix((GLfloat*)jointToWorld.mMatrix);
+ buff->setBuffer(mask);
+ buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
+ gGL.popMatrix();
}
gPipeline.addTrianglesDrawn(count);
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index eff16b6a6e..6482336f37 100644
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -825,14 +825,14 @@ S32 LLViewerParcelOverlay::renderPropertyLines ()
// Always fudge a little vertically.
pull_toward_camera.mV[VZ] += 0.01f;
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
// Move to appropriate region coords
LLVector3 origin = mRegion->getOriginAgent();
- glTranslatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
+ gGL.translatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] );
- glTranslatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
+ gGL.translatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY],
pull_toward_camera.mV[VZ]);
// Include +1 because vertices are fenceposts.
@@ -931,7 +931,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines ()
}
- glPopMatrix();
+ gGL.popMatrix();
return drawn;
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 36106752a2..7155311f8e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -65,15 +65,22 @@ LLVector4 gShinyOrigin;
LLGLSLShader gOcclusionProgram;
LLGLSLShader gCustomAlphaProgram;
LLGLSLShader gGlowCombineProgram;
+LLGLSLShader gSplatTextureRectProgram;
+LLGLSLShader gGlowCombineFXAAProgram;
LLGLSLShader gTwoTextureAddProgram;
+LLGLSLShader gOneTextureNoColorProgram;
+LLGLSLShader gDebugProgram;
//object shaders
LLGLSLShader gObjectSimpleProgram;
+LLGLSLShader gObjectPreviewProgram;
LLGLSLShader gObjectSimpleWaterProgram;
LLGLSLShader gObjectSimpleAlphaMaskProgram;
LLGLSLShader gObjectSimpleWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightProgram;
LLGLSLShader gObjectFullbrightWaterProgram;
+LLGLSLShader gObjectEmissiveProgram;
+LLGLSLShader gObjectEmissiveWaterProgram;
LLGLSLShader gObjectFullbrightAlphaMaskProgram;
LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
LLGLSLShader gObjectFullbrightShinyProgram;
@@ -81,13 +88,21 @@ LLGLSLShader gObjectFullbrightShinyWaterProgram;
LLGLSLShader gObjectShinyProgram;
LLGLSLShader gObjectShinyWaterProgram;
LLGLSLShader gObjectBumpProgram;
+LLGLSLShader gTreeProgram;
+LLGLSLShader gTreeWaterProgram;
+LLGLSLShader gObjectFullbrightNoColorProgram;
+LLGLSLShader gObjectFullbrightNoColorWaterProgram;
LLGLSLShader gObjectSimpleNonIndexedProgram;
LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
+LLGLSLShader gObjectAlphaMaskNoColorProgram;
+LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
LLGLSLShader gObjectFullbrightNonIndexedProgram;
LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
+LLGLSLShader gObjectEmissiveNonIndexedProgram;
+LLGLSLShader gObjectEmissiveNonIndexedWaterProgram;
LLGLSLShader gObjectFullbrightShinyNonIndexedProgram;
LLGLSLShader gObjectFullbrightShinyNonIndexedWaterProgram;
LLGLSLShader gObjectShinyNonIndexedProgram;
@@ -96,11 +111,13 @@ LLGLSLShader gObjectShinyNonIndexedWaterProgram;
//object hardware skinning shaders
LLGLSLShader gSkinnedObjectSimpleProgram;
LLGLSLShader gSkinnedObjectFullbrightProgram;
+LLGLSLShader gSkinnedObjectEmissiveProgram;
LLGLSLShader gSkinnedObjectFullbrightShinyProgram;
LLGLSLShader gSkinnedObjectShinySimpleProgram;
LLGLSLShader gSkinnedObjectSimpleWaterProgram;
LLGLSLShader gSkinnedObjectFullbrightWaterProgram;
+LLGLSLShader gSkinnedObjectEmissiveWaterProgram;
LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram;
LLGLSLShader gSkinnedObjectShinySimpleWaterProgram;
@@ -124,6 +141,7 @@ LLGLSLShader gImpostorProgram;
LLGLSLShader gWLSkyProgram;
LLGLSLShader gWLCloudProgram;
+
// Effects Shaders
LLGLSLShader gGlowProgram;
LLGLSLShader gGlowExtractProgram;
@@ -138,12 +156,14 @@ LLGLSLShader gDeferredDiffuseProgram;
LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
LLGLSLShader gDeferredNonIndexedDiffuseProgram;
LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
LLGLSLShader gDeferredBumpProgram;
LLGLSLShader gDeferredTerrainProgram;
LLGLSLShader gDeferredTreeProgram;
+LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredAvatarProgram;
LLGLSLShader gDeferredAvatarAlphaProgram;
LLGLSLShader gDeferredLightProgram;
@@ -160,6 +180,7 @@ LLGLSLShader gDeferredAttachmentShadowProgram;
LLGLSLShader gDeferredAlphaProgram;
LLGLSLShader gDeferredAvatarEyesProgram;
LLGLSLShader gDeferredFullbrightProgram;
+LLGLSLShader gDeferredEmissiveProgram;
LLGLSLShader gDeferredGIProgram;
LLGLSLShader gDeferredGIFinalProgram;
LLGLSLShader gDeferredPostGIProgram;
@@ -170,10 +191,6 @@ LLGLSLShader gDeferredWLCloudProgram;
LLGLSLShader gDeferredStarProgram;
LLGLSLShader gLuminanceGatherProgram;
-
-//current avatar shader parameter pointer
-GLint gAvatarMatrixParam;
-
LLViewerShaderMgr::LLViewerShaderMgr() :
mVertexShaderLevel(SHADER_COUNT, 0),
mMaxAvatarShaderLevel(0)
@@ -187,15 +204,23 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gWaterProgram);
mShaderList.push_back(&gAvatarEyeballProgram);
mShaderList.push_back(&gObjectSimpleProgram);
+ mShaderList.push_back(&gObjectPreviewProgram);
mShaderList.push_back(&gImpostorProgram);
+ mShaderList.push_back(&gObjectFullbrightNoColorProgram);
+ mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram);
mShaderList.push_back(&gObjectSimpleAlphaMaskProgram);
mShaderList.push_back(&gObjectBumpProgram);
mShaderList.push_back(&gUIProgram);
mShaderList.push_back(&gCustomAlphaProgram);
mShaderList.push_back(&gGlowCombineProgram);
+ mShaderList.push_back(&gGlowCombineFXAAProgram);
mShaderList.push_back(&gTwoTextureAddProgram);
+ mShaderList.push_back(&gOneTextureNoColorProgram);
mShaderList.push_back(&gSolidColorProgram);
mShaderList.push_back(&gOcclusionProgram);
+ mShaderList.push_back(&gDebugProgram);
+ mShaderList.push_back(&gObjectEmissiveProgram);
+ mShaderList.push_back(&gObjectEmissiveWaterProgram);
mShaderList.push_back(&gObjectFullbrightProgram);
mShaderList.push_back(&gObjectFullbrightAlphaMaskProgram);
mShaderList.push_back(&gObjectFullbrightShinyProgram);
@@ -204,16 +229,24 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gObjectSimpleNonIndexedWaterProgram);
mShaderList.push_back(&gObjectAlphaMaskNonIndexedProgram);
mShaderList.push_back(&gObjectAlphaMaskNonIndexedWaterProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNoColorProgram);
+ mShaderList.push_back(&gObjectAlphaMaskNoColorWaterProgram);
+ mShaderList.push_back(&gTreeProgram);
+ mShaderList.push_back(&gTreeWaterProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedProgram);
mShaderList.push_back(&gObjectFullbrightNonIndexedWaterProgram);
+ mShaderList.push_back(&gObjectEmissiveNonIndexedProgram);
+ mShaderList.push_back(&gObjectEmissiveNonIndexedWaterProgram);
mShaderList.push_back(&gObjectFullbrightShinyNonIndexedProgram);
mShaderList.push_back(&gObjectFullbrightShinyNonIndexedWaterProgram);
mShaderList.push_back(&gSkinnedObjectSimpleProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightProgram);
+ mShaderList.push_back(&gSkinnedObjectEmissiveProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightShinyProgram);
mShaderList.push_back(&gSkinnedObjectShinySimpleProgram);
mShaderList.push_back(&gSkinnedObjectSimpleWaterProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightWaterProgram);
+ mShaderList.push_back(&gSkinnedObjectEmissiveWaterProgram);
mShaderList.push_back(&gSkinnedObjectFullbrightShinyWaterProgram);
mShaderList.push_back(&gSkinnedObjectShinySimpleWaterProgram);
mShaderList.push_back(&gTerrainProgram);
@@ -234,6 +267,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
mShaderList.push_back(&gDeferredFullbrightProgram);
+ mShaderList.push_back(&gDeferredEmissiveProgram);
mShaderList.push_back(&gDeferredAvatarEyesProgram);
mShaderList.push_back(&gDeferredPostGIProgram);
mShaderList.push_back(&gDeferredEdgeProgram);
@@ -268,19 +302,24 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
{
if (mReservedAttribs.empty())
{
- mReservedAttribs.push_back("materialColor");
- mReservedAttribs.push_back("specularColor");
+ //MUST match order of enum in LLVertexBuffer.h
+ mReservedAttribs.push_back("position");
+ mReservedAttribs.push_back("normal");
+ mReservedAttribs.push_back("texcoord0");
+ mReservedAttribs.push_back("texcoord1");
+ mReservedAttribs.push_back("texcoord2");
+ mReservedAttribs.push_back("texcoord3");
+ mReservedAttribs.push_back("diffuse_color");
+ mReservedAttribs.push_back("emissive");
mReservedAttribs.push_back("binormal");
- mReservedAttribs.push_back("object_weight");
-
- mAvatarAttribs.reserve(5);
- mAvatarAttribs.push_back("weight");
- mAvatarAttribs.push_back("clothing");
- mAvatarAttribs.push_back("gWindDir");
- mAvatarAttribs.push_back("gSinWaveParams");
- mAvatarAttribs.push_back("gGravity");
+ mReservedAttribs.push_back("weight");
+ mReservedAttribs.push_back("weight4");
+ mReservedAttribs.push_back("clothing");
mAvatarUniforms.push_back("matrixPalette");
+ mAvatarUniforms.push_back("gWindDir");
+ mAvatarUniforms.push_back("gSinWaveParams");
+ mAvatarUniforms.push_back("gGravity");
mReservedUniforms.reserve(24);
mReservedUniforms.push_back("diffuseMap");
@@ -341,7 +380,7 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
mReservedUniforms.push_back("lastNormalGIMap");
mReservedUniforms.push_back("lastMinpGIMap");
mReservedUniforms.push_back("lastMaxpGIMap");
-
+
mWLUniforms.push_back("camPosLocal");
mTerrainUniforms.reserve(5);
@@ -446,6 +485,7 @@ void LLViewerShaderMgr::setShaders()
mMaxAvatarShaderLevel = 0;
LLGLSLShader::sNoFixedFunction = false;
+ LLVertexBuffer::unbind();
if (LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")
&& gSavedSettings.getBOOL("VertexShaderEnable"))
{
@@ -633,13 +673,20 @@ void LLViewerShaderMgr::setShaders()
void LLViewerShaderMgr::unloadShaders()
{
gOcclusionProgram.unload();
+ gDebugProgram.unload();
gUIProgram.unload();
gCustomAlphaProgram.unload();
gGlowCombineProgram.unload();
+ gSplatTextureRectProgram.unload();
+ gGlowCombineFXAAProgram.unload();
gTwoTextureAddProgram.unload();
+ gOneTextureNoColorProgram.unload();
gSolidColorProgram.unload();
+ gObjectFullbrightNoColorProgram.unload();
+ gObjectFullbrightNoColorWaterProgram.unload();
gObjectSimpleProgram.unload();
+ gObjectPreviewProgram.unload();
gImpostorProgram.unload();
gObjectSimpleAlphaMaskProgram.unload();
gObjectBumpProgram.unload();
@@ -647,6 +694,8 @@ void LLViewerShaderMgr::unloadShaders()
gObjectSimpleWaterAlphaMaskProgram.unload();
gObjectFullbrightProgram.unload();
gObjectFullbrightWaterProgram.unload();
+ gObjectEmissiveProgram.unload();
+ gObjectEmissiveWaterProgram.unload();
gObjectFullbrightAlphaMaskProgram.unload();
gObjectFullbrightWaterAlphaMaskProgram.unload();
@@ -659,8 +708,14 @@ void LLViewerShaderMgr::unloadShaders()
gObjectSimpleNonIndexedWaterProgram.unload();
gObjectAlphaMaskNonIndexedProgram.unload();
gObjectAlphaMaskNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNoColorProgram.unload();
+ gObjectAlphaMaskNoColorWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
+ gObjectEmissiveNonIndexedProgram.unload();
+ gObjectEmissiveNonIndexedWaterProgram.unload();
+ gTreeProgram.unload();
+ gTreeWaterProgram.unload();
gObjectShinyNonIndexedProgram.unload();
gObjectFullbrightShinyNonIndexedProgram.unload();
@@ -669,11 +724,13 @@ void LLViewerShaderMgr::unloadShaders()
gSkinnedObjectSimpleProgram.unload();
gSkinnedObjectFullbrightProgram.unload();
+ gSkinnedObjectEmissiveProgram.unload();
gSkinnedObjectFullbrightShinyProgram.unload();
gSkinnedObjectShinySimpleProgram.unload();
gSkinnedObjectSimpleWaterProgram.unload();
gSkinnedObjectFullbrightWaterProgram.unload();
+ gSkinnedObjectEmissiveWaterProgram.unload();
gSkinnedObjectFullbrightShinyWaterProgram.unload();
gSkinnedObjectShinySimpleWaterProgram.unload();
@@ -699,6 +756,7 @@ void LLViewerShaderMgr::unloadShaders()
gDeferredDiffuseProgram.unload();
gDeferredDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -1055,9 +1113,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (mVertexShaderLevel[SHADER_DEFERRED] == 0)
{
gDeferredTreeProgram.unload();
+ gDeferredTreeShadowProgram.unload();
gDeferredDiffuseProgram.unload();
gDeferredDiffuseAlphaMaskProgram.unload();
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
gDeferredNonIndexedDiffuseProgram.unload();
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
@@ -1080,6 +1140,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.unload();
gDeferredAlphaProgram.unload();
gDeferredFullbrightProgram.unload();
+ gDeferredEmissiveProgram.unload();
gDeferredAvatarEyesProgram.unload();
gDeferredPostGIProgram.unload();
gDeferredEdgeProgram.unload();
@@ -1098,8 +1159,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
BOOL success = TRUE;
- U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
- bool multisample = samples > 1 && gGLManager.mHasTextureMultisample;
+ U32 samples = gSavedSettings.getU32("RenderFSAASamples");
+ bool multisample = samples > 1;
if (success)
{
@@ -1132,6 +1193,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
}
+
+ if (success)
+ {
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mName = "Deferred Diffuse Non-Indexed Alpha Mask Shader";
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ }
if (success)
{
@@ -1205,6 +1276,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredTreeShadowProgram.mName = "Deferred Tree Shadow Shader";
+ gDeferredTreeShadowProgram.mShaderFiles.clear();
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredTreeShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gDeferredImpostorProgram.mName = "Deferred Impostor Shader";
gDeferredImpostorProgram.mShaderFiles.clear();
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1214,84 +1295,41 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
if (success)
- {
- std::string fragment;
-
- if (multisample)
- {
- fragment = "deferred/pointLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/pointLightF.glsl";
- }
-
+ {
gDeferredLightProgram.mName = "Deferred Light Shader";
gDeferredLightProgram.mShaderFiles.clear();
gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredLightProgram.createShader(NULL, NULL);
}
if (success)
{
- std::string fragment;
- if (multisample)
- {
- fragment = "deferred/multiPointLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/multiPointLightF.glsl";
- }
-
gDeferredMultiLightProgram.mName = "Deferred MultiLight Shader";
gDeferredMultiLightProgram.mShaderFiles.clear();
gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredMultiLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredMultiLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredMultiLightProgram.createShader(NULL, NULL);
}
if (success)
{
- std::string fragment;
-
- if (multisample)
- {
- fragment = "deferred/spotLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/multiSpotLightF.glsl";
- }
-
gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader";
gDeferredSpotLightProgram.mShaderFiles.clear();
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSpotLightProgram.createShader(NULL, NULL);
}
if (success)
{
- std::string fragment;
-
- if (multisample)
- {
- fragment = "deferred/multiSpotLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/multiSpotLightF.glsl";
- }
-
gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader";
gDeferredMultiSpotLightProgram.mShaderFiles.clear();
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
}
@@ -1302,25 +1340,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
{
- if (multisample)
- {
- fragment = "deferred/sunLightSSAOMSF.glsl";
- }
- else
- {
- fragment = "deferred/sunLightSSAOF.glsl";
- }
+ fragment = "deferred/sunLightSSAOF.glsl";
}
else
{
- if (multisample)
- {
- fragment = "deferred/sunLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/sunLightF.glsl";
- }
+ fragment = "deferred/sunLightF.glsl";
}
gDeferredSunProgram.mName = "Deferred Sun Shader";
@@ -1333,21 +1357,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
- std::string fragment;
-
- if (multisample)
- {
- fragment = "deferred/blurLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/blurLightF.glsl";
- }
-
gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader";
gDeferredBlurLightProgram.mShaderFiles.clear();
gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredBlurLightProgram.mShaderFiles.push_back(make_pair("deferred/blurLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredBlurLightProgram.createShader(NULL, NULL);
}
@@ -1407,6 +1420,20 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
+ gDeferredEmissiveProgram.mName = "Deferred Emissive Shader";
+ gDeferredEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredEmissiveProgram.mFeatures.hasGamma = true;
+ gDeferredEmissiveProgram.mFeatures.hasTransport = true;
+ gDeferredEmissiveProgram.mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits;
+ gDeferredEmissiveProgram.mShaderFiles.clear();
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ success = gDeferredEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
// load water shader
gDeferredWaterProgram.mName = "Deferred Water Shader";
gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true;
@@ -1421,21 +1448,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
- std::string fragment;
-
- if (multisample)
- {
- fragment = "deferred/softenLightMSF.glsl";
- }
- else
- {
- fragment = "deferred/softenLightF.glsl";
- }
-
gDeferredSoftenProgram.mName = "Deferred Soften Shader";
gDeferredSoftenProgram.mShaderFiles.clear();
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredSoftenProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSoftenProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
@@ -1475,7 +1491,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarShadowProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1507,7 +1523,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1522,9 +1538,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarAlphaProgram.mShaderFiles.clear();
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
- success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -1532,11 +1548,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
std::string fragment;
if (multisample)
{
- fragment = "deferred/postDeferredMSF.glsl";
+ fragment = "deferred/postDeferredF.glsl";
}
else
{
- fragment = "deferred/postDeferredF.glsl";
+ fragment = "deferred/postDeferredNoFXAAF.glsl";
}
gDeferredPostProgram.mName = "Deferred Post Shader";
@@ -1552,11 +1568,11 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
std::string fragment;
if (multisample)
{
- fragment = "deferred/postDeferredNoDoFMSF.glsl";
+ fragment = "deferred/postDeferredNoDoFF.glsl";
}
else
{
- fragment = "deferred/postDeferredNoDoFF.glsl";
+ fragment = "deferred/postDeferredNoDoFNoFXAAF.glsl";
}
gDeferredPostNoDoFProgram.mName = "Deferred Post Shader";
@@ -1605,20 +1621,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
{
if (success)
{
- std::string fragment;
- if (multisample)
- {
- fragment = "deferred/edgeMSF.glsl";
- }
- else
- {
- fragment = "deferred/edgeF.glsl";
- }
-
gDeferredEdgeProgram.mName = "Deferred Edge Shader";
gDeferredEdgeProgram.mShaderFiles.clear();
gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeV.glsl", GL_VERTEX_SHADER_ARB));
- gDeferredEdgeProgram.mShaderFiles.push_back(make_pair(fragment, GL_FRAGMENT_SHADER_ARB));
+ gDeferredEdgeProgram.mShaderFiles.push_back(make_pair("deferred/edgeF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredEdgeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredEdgeProgram.createShader(NULL, NULL);
}
@@ -1680,12 +1686,17 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectFullbrightShinyProgram.unload();
gObjectFullbrightShinyWaterProgram.unload();
gObjectShinyWaterProgram.unload();
+ gObjectFullbrightNoColorProgram.unload();
+ gObjectFullbrightNoColorWaterProgram.unload();
gObjectSimpleProgram.unload();
+ gObjectPreviewProgram.unload();
gImpostorProgram.unload();
gObjectSimpleAlphaMaskProgram.unload();
gObjectBumpProgram.unload();
gObjectSimpleWaterProgram.unload();
gObjectSimpleWaterAlphaMaskProgram.unload();
+ gObjectEmissiveProgram.unload();
+ gObjectEmissiveWaterProgram.unload();
gObjectFullbrightProgram.unload();
gObjectFullbrightAlphaMaskProgram.unload();
gObjectFullbrightWaterProgram.unload();
@@ -1698,16 +1709,24 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectSimpleNonIndexedWaterProgram.unload();
gObjectAlphaMaskNonIndexedProgram.unload();
gObjectAlphaMaskNonIndexedWaterProgram.unload();
+ gObjectAlphaMaskNoColorProgram.unload();
+ gObjectAlphaMaskNoColorWaterProgram.unload();
gObjectFullbrightNonIndexedProgram.unload();
gObjectFullbrightNonIndexedWaterProgram.unload();
+ gObjectEmissiveNonIndexedProgram.unload();
+ gObjectEmissiveNonIndexedWaterProgram.unload();
gSkinnedObjectSimpleProgram.unload();
gSkinnedObjectFullbrightProgram.unload();
+ gSkinnedObjectEmissiveProgram.unload();
gSkinnedObjectFullbrightShinyProgram.unload();
gSkinnedObjectShinySimpleProgram.unload();
gSkinnedObjectSimpleWaterProgram.unload();
gSkinnedObjectFullbrightWaterProgram.unload();
+ gSkinnedObjectEmissiveWaterProgram.unload();
gSkinnedObjectFullbrightShinyWaterProgram.unload();
gSkinnedObjectShinySimpleWaterProgram.unload();
+ gTreeProgram.unload();
+ gTreeWaterProgram.unload();
return TRUE;
}
@@ -1756,7 +1775,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectAlphaMaskNonIndexedProgram.mFeatures.disableTextureIndex = true;
gObjectAlphaMaskNonIndexedProgram.mFeatures.hasAlphaMask = true;
gObjectAlphaMaskNonIndexedProgram.mShaderFiles.clear();
- gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
gObjectAlphaMaskNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
gObjectAlphaMaskNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
success = gObjectAlphaMaskNonIndexedProgram.createShader(NULL, NULL);
@@ -1773,7 +1792,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
gObjectAlphaMaskNonIndexedWaterProgram.mFeatures.hasAlphaMask = true;
gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.clear();
- gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNonIndexedV.glsl", GL_VERTEX_SHADER_ARB));
gObjectAlphaMaskNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
gObjectAlphaMaskNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
gObjectAlphaMaskNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
@@ -1782,6 +1801,76 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectAlphaMaskNoColorProgram.mName = "No color alpha mask Shader";
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasGamma = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNoColorProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectAlphaMaskNoColorWaterProgram.mName = "No color alpha mask Water Shader";
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasLighting = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectAlphaMaskNoColorWaterProgram.mFeatures.hasAlphaMask = true;
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.clear();
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectAlphaMaskNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectAlphaMaskNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectAlphaMaskNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectAlphaMaskNoColorWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gTreeProgram.mName = "Tree Shader";
+ gTreeProgram.mFeatures.calculatesLighting = true;
+ gTreeProgram.mFeatures.calculatesAtmospherics = true;
+ gTreeProgram.mFeatures.hasGamma = true;
+ gTreeProgram.mFeatures.hasAtmospherics = true;
+ gTreeProgram.mFeatures.hasLighting = true;
+ gTreeProgram.mFeatures.disableTextureIndex = true;
+ gTreeProgram.mFeatures.hasAlphaMask = true;
+ gTreeProgram.mShaderFiles.clear();
+ gTreeProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+ gTreeProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTreeProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gTreeProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gTreeWaterProgram.mName = "Tree Water Shader";
+ gTreeWaterProgram.mFeatures.calculatesLighting = true;
+ gTreeWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gTreeWaterProgram.mFeatures.hasWaterFog = true;
+ gTreeWaterProgram.mFeatures.hasAtmospherics = true;
+ gTreeWaterProgram.mFeatures.hasLighting = true;
+ gTreeWaterProgram.mFeatures.disableTextureIndex = true;
+ gTreeWaterProgram.mFeatures.hasAlphaMask = true;
+ gTreeWaterProgram.mShaderFiles.clear();
+ gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/treeV.glsl", GL_VERTEX_SHADER_ARB));
+ gTreeWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gTreeWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gTreeWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gTreeWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightNonIndexedProgram.mName = "Non Indexed Fullbright Shader";
gObjectFullbrightNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightNonIndexedProgram.mFeatures.hasGamma = true;
@@ -1813,6 +1902,68 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectEmissiveNonIndexedProgram.mName = "Non Indexed Emissive Shader";
+ gObjectEmissiveNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.hasGamma = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveNonIndexedProgram.mFeatures.disableTextureIndex = true;
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.clear();
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectEmissiveNonIndexedProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectEmissiveNonIndexedWaterProgram.mName = "Non Indexed Emissive Water Shader";
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveNonIndexedWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.clear();
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectEmissiveNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectEmissiveNonIndexedWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightNoColorProgram.mName = "Non Indexed no color Fullbright Shader";
+ gObjectFullbrightNoColorProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightNoColorProgram.mFeatures.hasGamma = true;
+ gObjectFullbrightNoColorProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightNoColorProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightNoColorProgram.mFeatures.disableTextureIndex = true;
+ gObjectFullbrightNoColorProgram.mShaderFiles.clear();
+ gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightNoColorProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectFullbrightNoColorProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectFullbrightNoColorWaterProgram.mName = "Non Indexed no color Fullbright Water Shader";
+ gObjectFullbrightNoColorWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.isFullbright = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.hasTransport = true;
+ gObjectFullbrightNoColorWaterProgram.mFeatures.disableTextureIndex = true;
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.clear();
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightNoColorV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectFullbrightNoColorWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectFullbrightNoColorWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectFullbrightNoColorWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectFullbrightNoColorWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectShinyNonIndexedProgram.mName = "Non Indexed Shiny Shader";
gObjectShinyNonIndexedProgram.mFeatures.calculatesAtmospherics = true;
gObjectShinyNonIndexedProgram.mFeatures.calculatesLighting = true;
@@ -1891,6 +2042,23 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectPreviewProgram.mName = "Simple Shader";
+ gObjectPreviewProgram.mFeatures.calculatesLighting = true;
+ gObjectPreviewProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectPreviewProgram.mFeatures.hasGamma = true;
+ gObjectPreviewProgram.mFeatures.hasAtmospherics = true;
+ gObjectPreviewProgram.mFeatures.hasLighting = true;
+ gObjectPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
+ gObjectPreviewProgram.mShaderFiles.clear();
+ gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectPreviewProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectPreviewProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectSimpleProgram.mName = "Simple Shader";
gObjectSimpleProgram.mFeatures.calculatesLighting = true;
gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true;
@@ -1907,19 +2075,19 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
- gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
- gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
- gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
- gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
- gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
- gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
- gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
- success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
+ gObjectSimpleWaterProgram.mName = "Simple Water Shader";
+ gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
+ gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleWaterProgram.mShaderFiles.clear();
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
}
if (success)
@@ -1938,23 +2106,24 @@ BOOL LLViewerShaderMgr::loadShadersObject()
success = gObjectBumpProgram.createShader(NULL, NULL);
}
+
if (success)
{
- gObjectSimpleWaterProgram.mName = "Simple Water Shader";
- gObjectSimpleWaterProgram.mFeatures.calculatesLighting = true;
- gObjectSimpleWaterProgram.mFeatures.calculatesAtmospherics = true;
- gObjectSimpleWaterProgram.mFeatures.hasWaterFog = true;
- gObjectSimpleWaterProgram.mFeatures.hasAtmospherics = true;
- gObjectSimpleWaterProgram.mFeatures.hasLighting = true;
- gObjectSimpleWaterProgram.mFeatures.mIndexedTextureChannels = 0;
- gObjectSimpleWaterProgram.mShaderFiles.clear();
- gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
- gObjectSimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/simpleWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
- gObjectSimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
- gObjectSimpleWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- success = gObjectSimpleWaterProgram.createShader(NULL, NULL);
+ gObjectSimpleAlphaMaskProgram.mName = "Simple Alpha Mask Shader";
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasGamma = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAtmospherics = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasLighting = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.hasAlphaMask = true;
+ gObjectSimpleAlphaMaskProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.clear();
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectSimpleAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectSimpleAlphaMaskProgram.createShader(NULL, NULL);
}
-
+
if (success)
{
gObjectSimpleWaterAlphaMaskProgram.mName = "Simple Water Alpha Mask Shader";
@@ -2006,6 +2175,37 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gObjectEmissiveProgram.mName = "Emissive Shader";
+ gObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveProgram.mFeatures.hasGamma = true;
+ gObjectEmissiveProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectEmissiveProgram.mShaderFiles.clear();
+ gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gObjectEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gObjectEmissiveWaterProgram.mName = "Emissive Water Shader";
+ gObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+ gObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;
+ gObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+ gObjectEmissiveWaterProgram.mFeatures.mIndexedTextureChannels = 0;
+ gObjectEmissiveWaterProgram.mShaderFiles.clear();
+ gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveV.glsl", GL_VERTEX_SHADER_ARB));
+ gObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ gObjectEmissiveWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
+ success = gObjectEmissiveWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gObjectFullbrightAlphaMaskProgram.mName = "Fullbright Alpha Mask Shader";
gObjectFullbrightAlphaMaskProgram.mFeatures.calculatesAtmospherics = true;
gObjectFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
@@ -2141,6 +2341,39 @@ BOOL LLViewerShaderMgr::loadShadersObject()
if (success)
{
+ gSkinnedObjectEmissiveProgram.mName = "Skinned Emissive Shader";
+ gSkinnedObjectEmissiveProgram.mFeatures.calculatesAtmospherics = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasGamma = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasTransport = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.isFullbright = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.hasObjectSkinning = true;
+ gSkinnedObjectEmissiveProgram.mFeatures.disableTextureIndex = true;
+ gSkinnedObjectEmissiveProgram.mShaderFiles.clear();
+ gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+ gSkinnedObjectEmissiveProgram.mShaderFiles.push_back(make_pair("objects/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gSkinnedObjectEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gSkinnedObjectEmissiveProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
+ gSkinnedObjectEmissiveWaterProgram.mName = "Skinned Emissive Water Shader";
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasGamma = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasTransport = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.isFullbright = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasObjectSkinning = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.disableTextureIndex = true;
+ gSkinnedObjectEmissiveWaterProgram.mFeatures.hasWaterFog = true;
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.clear();
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/emissiveSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
+ gSkinnedObjectEmissiveWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gSkinnedObjectEmissiveWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
+ success = gSkinnedObjectEmissiveWaterProgram.createShader(NULL, NULL);
+ }
+
+ if (success)
+ {
gSkinnedObjectFullbrightShinyProgram.mName = "Skinned Fullbright Shiny Shader";
gSkinnedObjectFullbrightShinyProgram.mFeatures.calculatesAtmospherics = true;
gSkinnedObjectFullbrightShinyProgram.mFeatures.hasGamma = true;
@@ -2287,7 +2520,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
- success = gAvatarProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarProgram.createShader(NULL, &mAvatarUniforms);
if (success)
{
@@ -2306,7 +2539,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
// Note: no cloth under water:
gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);
gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- success = gAvatarWaterProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms);
}
/// Keep track of avatar levels
@@ -2325,7 +2558,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
- success = gAvatarPickProgram.createShader(&mAvatarAttribs, &mAvatarUniforms);
+ success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms);
}
if (success)
@@ -2398,6 +2631,22 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gSplatTextureRectProgram.mName = "Splat Texture Rect Shader";
+ gSplatTextureRectProgram.mShaderFiles.clear();
+ gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER_ARB));
+ gSplatTextureRectProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gSplatTextureRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gSplatTextureRectProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gSplatTextureRectProgram.bind();
+ gSplatTextureRectProgram.uniform1i("screenMap", 0);
+ gSplatTextureRectProgram.unbind();
+ }
+ }
+
+ if (success)
+ {
gGlowCombineProgram.mName = "Glow Combine Shader";
gGlowCombineProgram.mShaderFiles.clear();
gGlowCombineProgram.mShaderFiles.push_back(make_pair("interface/glowcombineV.glsl", GL_VERTEX_SHADER_ARB));
@@ -2415,6 +2664,24 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gGlowCombineFXAAProgram.mName = "Glow CombineFXAA Shader";
+ gGlowCombineFXAAProgram.mShaderFiles.clear();
+ gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAV.glsl", GL_VERTEX_SHADER_ARB));
+ gGlowCombineFXAAProgram.mShaderFiles.push_back(make_pair("interface/glowcombineFXAAF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gGlowCombineFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gGlowCombineFXAAProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gGlowCombineFXAAProgram.bind();
+ gGlowCombineFXAAProgram.uniform1i("glowMap", 0);
+ gGlowCombineFXAAProgram.uniform1i("screenMap", 1);
+ gGlowCombineFXAAProgram.unbind();
+ }
+ }
+
+
+ if (success)
+ {
gTwoTextureAddProgram.mName = "Two Texture Add Shader";
gTwoTextureAddProgram.mShaderFiles.clear();
gTwoTextureAddProgram.mShaderFiles.push_back(make_pair("interface/twotextureaddV.glsl", GL_VERTEX_SHADER_ARB));
@@ -2431,6 +2698,21 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
+ gOneTextureNoColorProgram.mName = "One Texture No Color Shader";
+ gOneTextureNoColorProgram.mShaderFiles.clear();
+ gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorV.glsl", GL_VERTEX_SHADER_ARB));
+ gOneTextureNoColorProgram.mShaderFiles.push_back(make_pair("interface/onetexturenocolorF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gOneTextureNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gOneTextureNoColorProgram.createShader(NULL, NULL);
+ if (success)
+ {
+ gOneTextureNoColorProgram.bind();
+ gOneTextureNoColorProgram.uniform1i("tex0", 0);
+ }
+ }
+
+ if (success)
+ {
gSolidColorProgram.mName = "Solid Color Shader";
gSolidColorProgram.mShaderFiles.clear();
gSolidColorProgram.mShaderFiles.push_back(make_pair("interface/solidcolorV.glsl", GL_VERTEX_SHADER_ARB));
@@ -2455,6 +2737,16 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
success = gOcclusionProgram.createShader(NULL, NULL);
}
+ if (success)
+ {
+ gDebugProgram.mName = "Debug Shader";
+ gDebugProgram.mShaderFiles.clear();
+ gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugV.glsl", GL_VERTEX_SHADER_ARB));
+ gDebugProgram.mShaderFiles.push_back(make_pair("interface/debugF.glsl", GL_FRAGMENT_SHADER_ARB));
+ gDebugProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
+ success = gDebugProgram.createShader(NULL, NULL);
+ }
+
if( !success )
{
mVertexShaderLevel[SHADER_INTERFACE] = 0;
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index d4040f11e1..1c9d7f8453 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -71,15 +71,6 @@ public:
SHADER_COUNT
};
- typedef enum
- {
- MATERIAL_COLOR = 0,
- SPECULAR_COLOR,
- BINORMAL,
- OBJECT_WEIGHT,
- END_RESERVED_ATTRIBS
- } eGLSLReservedAttribs;
-
typedef enum
{
DIFFUSE_MAP = 0,
@@ -186,16 +177,10 @@ public:
typedef enum
{
- AVATAR_WEIGHT = END_RESERVED_ATTRIBS,
- AVATAR_CLOTHING,
+ AVATAR_MATRIX = END_RESERVED_UNIFORMS,
AVATAR_WIND,
AVATAR_SINWAVE,
- AVATAR_GRAVITY
- } eAvatarAttribs;
-
- typedef enum
- {
- AVATAR_MATRIX = END_RESERVED_UNIFORMS
+ AVATAR_GRAVITY,
} eAvatarUniforms;
// simple model of forward iterator
@@ -265,9 +250,6 @@ private:
std::vector<std::string> mGlowExtractUniforms;
- //avatar shader parameter tables
- std::vector<std::string> mAvatarAttribs;
-
std::vector<std::string> mAvatarUniforms;
// the list of shaders we need to propagate parameters to.
@@ -291,12 +273,18 @@ extern LLVector4 gShinyOrigin;
extern LLGLSLShader gOcclusionProgram;
extern LLGLSLShader gCustomAlphaProgram;
extern LLGLSLShader gGlowCombineProgram;
+extern LLGLSLShader gSplatTextureRectProgram;
+extern LLGLSLShader gGlowCombineFXAAProgram;
+extern LLGLSLShader gDebugProgram;
//output tex0[tc0] + tex1[tc1]
extern LLGLSLShader gTwoTextureAddProgram;
-
+
+extern LLGLSLShader gOneTextureNoColorProgram;
+
//object shaders
extern LLGLSLShader gObjectSimpleProgram;
+extern LLGLSLShader gObjectPreviewProgram;
extern LLGLSLShader gObjectSimpleAlphaMaskProgram;
extern LLGLSLShader gObjectSimpleWaterProgram;
extern LLGLSLShader gObjectSimpleWaterAlphaMaskProgram;
@@ -304,13 +292,23 @@ extern LLGLSLShader gObjectSimpleNonIndexedProgram;
extern LLGLSLShader gObjectSimpleNonIndexedWaterProgram;
extern LLGLSLShader gObjectAlphaMaskNonIndexedProgram;
extern LLGLSLShader gObjectAlphaMaskNonIndexedWaterProgram;
+extern LLGLSLShader gObjectAlphaMaskNoColorProgram;
+extern LLGLSLShader gObjectAlphaMaskNoColorWaterProgram;
extern LLGLSLShader gObjectFullbrightProgram;
extern LLGLSLShader gObjectFullbrightWaterProgram;
+extern LLGLSLShader gObjectFullbrightNoColorProgram;
+extern LLGLSLShader gObjectFullbrightNoColorWaterProgram;
+extern LLGLSLShader gObjectEmissiveProgram;
+extern LLGLSLShader gObjectEmissiveWaterProgram;
extern LLGLSLShader gObjectFullbrightAlphaMaskProgram;
extern LLGLSLShader gObjectFullbrightWaterAlphaMaskProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedProgram;
extern LLGLSLShader gObjectFullbrightNonIndexedWaterProgram;
+extern LLGLSLShader gObjectEmissiveNonIndexedProgram;
+extern LLGLSLShader gObjectEmissiveNonIndexedWaterProgram;
extern LLGLSLShader gObjectBumpProgram;
+extern LLGLSLShader gTreeProgram;
+extern LLGLSLShader gTreeWaterProgram;
extern LLGLSLShader gObjectSimpleLODProgram;
extern LLGLSLShader gObjectFullbrightLODProgram;
@@ -327,11 +325,13 @@ extern LLGLSLShader gObjectShinyNonIndexedWaterProgram;
extern LLGLSLShader gSkinnedObjectSimpleProgram;
extern LLGLSLShader gSkinnedObjectFullbrightProgram;
+extern LLGLSLShader gSkinnedObjectEmissiveProgram;
extern LLGLSLShader gSkinnedObjectFullbrightShinyProgram;
extern LLGLSLShader gSkinnedObjectShinySimpleProgram;
extern LLGLSLShader gSkinnedObjectSimpleWaterProgram;
extern LLGLSLShader gSkinnedObjectFullbrightWaterProgram;
+extern LLGLSLShader gSkinnedObjectEmissiveWaterProgram;
extern LLGLSLShader gSkinnedObjectFullbrightShinyWaterProgram;
extern LLGLSLShader gSkinnedObjectShinySimpleWaterProgram;
@@ -368,6 +368,7 @@ extern LLGLSLShader gDeferredWaterProgram;
extern LLGLSLShader gDeferredDiffuseProgram;
extern LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
+extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedBumpProgram;
@@ -375,6 +376,7 @@ extern LLGLSLShader gDeferredSkinnedAlphaProgram;
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTreeProgram;
+extern LLGLSLShader gDeferredTreeShadowProgram;
extern LLGLSLShader gDeferredLightProgram;
extern LLGLSLShader gDeferredMultiLightProgram;
extern LLGLSLShader gDeferredSpotLightProgram;
@@ -394,6 +396,7 @@ extern LLGLSLShader gDeferredAvatarShadowProgram;
extern LLGLSLShader gDeferredAttachmentShadowProgram;
extern LLGLSLShader gDeferredAlphaProgram;
extern LLGLSLShader gDeferredFullbrightProgram;
+extern LLGLSLShader gDeferredEmissiveProgram;
extern LLGLSLShader gDeferredAvatarEyesProgram;
extern LLGLSLShader gDeferredAvatarAlphaProgram;
extern LLGLSLShader gDeferredWLSkyProgram;
@@ -401,8 +404,5 @@ extern LLGLSLShader gDeferredWLCloudProgram;
extern LLGLSLShader gDeferredStarProgram;
extern LLGLSLShader gLuminanceGatherProgram;
-//current avatar shader parameter pointer
-extern GLint gAvatarMatrixParam;
-
#endif
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 5893259d96..010bcfb125 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1732,10 +1732,7 @@ void LLViewerWindow::initGLDefaults()
glCullFace(GL_BACK);
// RN: Need this for translation and stretch manip.
- gCone.prerender();
gBox.prerender();
- gSphere.prerender();
- gCylinder.prerender();
}
struct MainPanel : public LLPanel
@@ -2247,6 +2244,10 @@ void LLViewerWindow::drawDebugText()
gGL.color4f(1,1,1,1);
gGL.pushMatrix();
gGL.pushUIMatrix();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
{
// scale view by UI global scale factor and aspect ratio correction factor
gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
@@ -2256,6 +2257,10 @@ void LLViewerWindow::drawDebugText()
gGL.popMatrix();
gGL.flush();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
}
void LLViewerWindow::draw()
@@ -2270,9 +2275,9 @@ void LLViewerWindow::draw()
LLUI::setLineWidth(1.f);
// Reset any left-over transforms
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
- glLoadIdentity();
+ gGL.loadIdentity();
//S32 screen_x, screen_y;
@@ -2287,7 +2292,7 @@ void LLViewerWindow::draw()
// draw timecode block
std::string text;
- glLoadIdentity();
+ gGL.loadIdentity();
microsecondsToTimecodeString(gFrameTime,text);
const LLFontGL* font = LLFontGL::getFontSansSerif();
@@ -2323,10 +2328,10 @@ void LLViewerWindow::draw()
int pos_y = sub_region / llceil(zoom_factor);
int pos_x = sub_region - (pos_y*llceil(zoom_factor));
// offset for this tile
- glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x,
+ gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x,
(F32)getWindowHeightScaled() * -(F32)pos_y,
0.f);
- glScalef(zoom_factor, zoom_factor, 1.f);
+ gGL.scalef(zoom_factor, zoom_factor, 1.f);
LLUI::sGLScaleFactor *= zoom_factor;
}
@@ -2355,7 +2360,7 @@ void LLViewerWindow::draw()
S32 screen_x, screen_y;
top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix();
LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
top_ctrl->draw();
@@ -3419,17 +3424,17 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
// set up transform to encompass bounding box of HUD
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
- glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
+ gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
- glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
+ gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
}
// Render light for editing
@@ -3439,12 +3444,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
LLGLEnable gls_blend(GL_BLEND);
LLGLEnable gls_cull(GL_CULL_FACE);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
if (selection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom, zoom, zoom);
+ gGL.scalef(zoom, zoom, zoom);
}
struct f : public LLSelectedObjectFunctor
@@ -3455,33 +3460,33 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
if (drawable && drawable->isLight())
{
LLVOVolume* vovolume = drawable->getVOVolume();
- glPushMatrix();
+ gGL.pushMatrix();
LLVector3 center = drawable->getPositionAgent();
- glTranslatef(center[0], center[1], center[2]);
+ gGL.translatef(center[0], center[1], center[2]);
F32 scale = vovolume->getLightRadius();
- glScalef(scale, scale, scale);
+ gGL.scalef(scale, scale, scale);
LLColor4 color(vovolume->getLightColor(), .5f);
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
- F32 pixel_area = 100000.f;
+ //F32 pixel_area = 100000.f;
// Render Outside
- gSphere.render(pixel_area);
+ gSphere.render();
// Render Inside
glCullFace(GL_FRONT);
- gSphere.render(pixel_area);
+ gSphere.render();
glCullFace(GL_BACK);
- glPopMatrix();
+ gGL.popMatrix();
}
return true;
}
} func;
LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
- glPopMatrix();
+ gGL.popMatrix();
}
// NOTE: The average position for the axis arrows of the selected objects should
@@ -3544,11 +3549,11 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
}
if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
{
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
stop_glerror();
}
}
@@ -4662,10 +4667,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
gPipeline.destroyGL();
}
- gCone.cleanupGL();
gBox.cleanupGL();
- gSphere.cleanupGL();
- gCylinder.cleanupGL();
if(gPostProcess)
{
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 510525259f..7e00350926 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -59,6 +59,12 @@ public:
// virtual
void setupVertexBuffer(U32 data_mask) const
{
+ if (LLGLSLShader::sNoFixedFunction)
+ { //just use default if shaders are in play
+ LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
+ return;
+ }
+
U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
//assume tex coords 2 and 3 are present
@@ -106,20 +112,6 @@ public:
glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
}
- if (data_mask & MAP_WEIGHT)
- {
- glVertexAttribPointerARB(1, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], (void*)(base + mOffsets[TYPE_WEIGHT]));
- }
-
- if (data_mask & MAP_WEIGHT4 && sWeight4Loc != -1)
- {
- glVertexAttribPointerARB(sWeight4Loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], (void*)(base+mOffsets[TYPE_WEIGHT4]));
- }
-
- if (data_mask & MAP_CLOTHWEIGHT)
- {
- glVertexAttribPointerARB(4, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]));
- }
if (data_mask & MAP_VERTEX)
{
glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index 890861df71..4cef0f5b5b 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -882,7 +882,7 @@ void LLVOTree::updateMesh()
// Translate to tree base HACK - adjustment in Z plants tree underground
const LLVector3 &pos_agent = getPositionAgent();
- //glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
+ //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
LLMatrix4 trans_mat;
trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
trans_mat *= matrix;
@@ -1158,7 +1158,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
scale_mat.mMatrix[2][2] = scale*length;
scale_mat *= matrix;
- glLoadMatrixf((F32*) scale_mat.mMatrix);
+ gGL.loadMatrix((F32*) scale_mat.mMatrix);
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]);
gPipeline.addTrianglesDrawn(LEAF_INDICES);
stop_glerror();
@@ -1208,7 +1209,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
scale_mat *= matrix;
- glLoadMatrixf((F32*) scale_mat.mMatrix);
+ gGL.loadMatrix((F32*) scale_mat.mMatrix);
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
gPipeline.addTrianglesDrawn(LEAF_INDICES);
stop_glerror();
@@ -1229,19 +1231,20 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
scale_mat *= matrix;
- glMatrixMode(GL_TEXTURE);
- glTranslatef(0.0, -0.5, 0.0);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.translatef(0.0, -0.5, 0.0);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
- glLoadMatrixf((F32*) scale_mat.mMatrix);
+ gGL.loadMatrix((F32*) scale_mat.mMatrix);
+ gGL.syncMatrices();
glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
gPipeline.addTrianglesDrawn(LEAF_INDICES);
stop_glerror();
ret += LEAF_INDICES;
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
return ret;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 528c7acbc8..3b31100305 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3836,8 +3836,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
-
if (idx >= 0 &&
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
@@ -3846,7 +3844,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
- draw_vec[idx]->mGlowColor.mV[3] == glow &&
draw_vec[idx]->mFullbright == fullbright &&
draw_vec[idx]->mBump == bump &&
draw_vec[idx]->mTextureMatrix == tex_mat &&
@@ -3878,7 +3875,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec.push_back(draw_info);
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
- draw_info->mGlowColor.setVec(0,0,0,glow);
if (type == LLRenderPass::PASS_ALPHA)
{ //for alpha sorting
facep->setDrawInfo(draw_info);
@@ -3978,6 +3974,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 cur_total = 0;
+ bool emissive = false;
+
//get all the faces into a list
for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
{
@@ -4189,6 +4187,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
+
if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
{
facep->clearVertexBuffer();
@@ -4202,6 +4201,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLTextureEntry* te = facep->getTextureEntry();
LLViewerTexture* tex = facep->getTexture();
+ if (te->getGlow() >= 1.f/255.f)
+ {
+ emissive = true;
+ }
+
if (facep->isState(LLFace::TEXTURE_ANIM))
{
if (!vobj->mTexAnimMode)
@@ -4318,6 +4322,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+ if (emissive)
+ { //emissive faces are present, include emissive byte to preserve batching
+ simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
+ alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
+ bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
+ fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
+ }
+
bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
if (batch_textures)
@@ -4461,10 +4473,6 @@ struct CompareBatchBreakerModified
{
return lte->getFullbright() < rte->getFullbright();
}
- else if (lte->getGlow() != rte->getGlow())
- {
- return lte->getGlow() < rte->getGlow();
- }
else
{
return lhs->getTexture() < rhs->getTexture();
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 7b1c725483..39c9945fb4 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -518,6 +518,7 @@ void LLVOWLSky::drawDome(void)
#else
mStripsVerts->setBuffer(data_mask);
+ gGL.syncMatrices();
glDrawRangeElements(
GL_TRIANGLES,
0, mStripsVerts->getNumVerts()-1, mStripsVerts->getNumIndices(),
diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp
index 02d914a812..22fba90f65 100644
--- a/indra/newview/llwlparamset.cpp
+++ b/indra/newview/llwlparamset.cpp
@@ -91,8 +91,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
val.mV[1] = F32(i->second[1].asReal()) + mCloudScrollYOffset;
val.mV[2] = (F32) i->second[2].asReal();
val.mV[3] = (F32) i->second[3].asReal();
-
- shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
+ shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
}
else // param is the uniform name
{
@@ -118,8 +119,9 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
{
val.mV[0] = i->second.asBoolean();
}
-
+ stop_glerror();
shader->uniform4fv(param, 1, val.mV);
+ stop_glerror();
}
}
}
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 265d5dc801..3959e7c073 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -314,7 +314,7 @@ void LLWorldMapView::draw()
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
// Clear the background alpha to 0
gGL.flush();
@@ -1307,7 +1307,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const
end_theta -= angle_adjust_y;
}
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.translatef((F32)x, (F32)y, 0.f);
gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a50f66f282..60d504e948 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -139,7 +139,7 @@ const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
const S32 MAX_OFFSCREEN_GEOMETRY_CHANGES_PER_FRAME = 10;
const U32 REFLECTION_MAP_RES = 128;
-
+const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
// Max number of occluders to search for. JC
const S32 MAX_OCCLUDER_COUNT = 2;
@@ -459,6 +459,8 @@ void LLPipeline::init()
mSpotLightFade[i] = 1.f;
}
+ mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
+ mDeferredVB->allocateBuffer(8, 0, true);
setLightingDetail(-1);
}
@@ -537,6 +539,8 @@ void LLPipeline::cleanup()
mMovedBridge.clear();
mInitialized = FALSE;
+
+ mDeferredVB = NULL;
}
//============================================================================
@@ -608,11 +612,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
{
U32 samples = gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"));
- if (gGLManager.mIsATI)
- { //ATI doesn't like the way we use multisample texture
- samples = 0;
- }
-
//try to allocate screen buffers at requested resolution and samples
// - on failure, shrink number of samples and try again
// - if not multisampled, shrink resolution and try again (favor X resolution over Y)
@@ -689,6 +688,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (!addDeferredAttachments(mDeferredScreen)) return false;
if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (samples > 0)
+ {
+ if (!mFXAABuffer.allocate(nhpo2(resX), nhpo2(resY), GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
+ }
+ else
+ {
+ mFXAABuffer.release();
+ }
#if LL_DARWIN
// As of OS X 10.6.7, Apple doesn't support multiple color formats in a single FBO
@@ -798,6 +805,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
{
mShadow[i].release();
}
+ mFXAABuffer.release();
mScreen.release();
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
mDeferredDepth.release();
@@ -883,6 +891,7 @@ void LLPipeline::releaseScreenBuffers()
{
mUIScreen.release();
mScreen.release();
+ mFXAABuffer.release();
mPhysicsDisplay.release();
mDeferredScreen.release();
mDeferredDepth.release();
@@ -2009,13 +2018,13 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
gGL.setColorMask(false, false);
}
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadMatrixd(gGLLastProjection);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLLastProjection);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLLastModelView);
+ gGL.loadMatrix(gGLLastModelView);
LLVertexBuffer::unbind();
@@ -2120,10 +2129,10 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
}
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
if (sUseOcclusion > 1)
{
@@ -3441,10 +3450,10 @@ void LLPipeline::renderHighlights()
//gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
gGL.pushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
- glLoadIdentity();
+ gGL.loadIdentity();
gGL.getTexUnit(0)->bind(&mHighlight);
@@ -3504,7 +3513,7 @@ void LLPipeline::renderHighlights()
gGL.end();
gGL.popMatrix();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
//gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -3513,7 +3522,7 @@ void LLPipeline::renderHighlights()
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightProgram.bind();
- gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,1,1,0.5f);
+ gHighlightProgram.uniform4f("highlight_color",1,1,1,0.5f);
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
@@ -3545,7 +3554,7 @@ void LLPipeline::renderHighlights()
color.setVec(1.f, 0.f, 0.f, 0.5f);
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
- gHighlightProgram.vertexAttrib4f(LLViewerShaderMgr::MATERIAL_COLOR,1,0,0,0.5f);
+ gHighlightProgram.uniform4f("highlight_color",1,0,0,0.5f);
}
int count = mHighlightFaces.size();
for (S32 i = 0; i < count; i++)
@@ -3620,9 +3629,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
LLAppViewer::instance()->pingMainloopTimeout("Pipeline:ForceVBO");
// Initialize lots of GL state to "safe" values
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
LLGLSPipeline gls_pipeline;
LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0);
@@ -3691,7 +3700,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{
occlude = FALSE;
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
doOcclusion(camera);
}
@@ -3702,7 +3711,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
LLFastTimer t(FTM_POOLRENDER);
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
for( S32 i = 0; i < poolp->getNumPasses(); i++ )
{
@@ -3751,13 +3760,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
LLVertexBuffer::unbind();
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
if (occlude)
{
occlude = FALSE;
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
doOcclusion(camera);
}
@@ -3877,7 +3886,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
LLFastTimer t(FTM_POOLRENDER);
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ )
{
@@ -3925,7 +3934,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
}
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
gGL.setColorMask(true, false);
}
@@ -3958,7 +3967,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{
occlude = FALSE;
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
doOcclusion(camera);
gGL.setColorMask(true, false);
@@ -3970,7 +3979,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
LLFastTimer t(FTM_POOLRENDER);
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ )
{
@@ -4018,17 +4027,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
}
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
if (occlude)
{
occlude = FALSE;
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
doOcclusion(camera);
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
}
}
@@ -4052,8 +4061,10 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
pool_set_t::iterator iter2 = iter1;
if (hasRenderType(poolp->getType()) && poolp->getNumShadowPasses() > 0)
{
+ poolp->prerender() ;
+
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ )
{
@@ -4092,7 +4103,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera)
}
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
}
@@ -4139,6 +4150,11 @@ void LLPipeline::renderPhysicsDisplay()
gGL.setColorMask(true, false);
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gDebugProgram.bind();
+ }
+
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
@@ -4161,15 +4177,20 @@ void LLPipeline::renderPhysicsDisplay()
LLSpatialBridge* bridge = *i;
if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
{
- glPushMatrix();
- glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
bridge->renderPhysicsShapes();
- glPopMatrix();
+ gGL.popMatrix();
}
}
-
gGL.flush();
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gDebugProgram.unbind();
+ }
+
mPhysicsDisplay.flush();
}
@@ -4183,7 +4204,7 @@ void LLPipeline::renderDebug()
gGL.color4f(1,1,1,1);
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
gGL.setColorMask(true, false);
bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
@@ -4243,13 +4264,18 @@ void LLPipeline::renderDebug()
LLSpatialBridge* bridge = *i;
if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
{
- glPushMatrix();
- glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+ gGL.pushMatrix();
+ gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
bridge->renderDebug();
- glPopMatrix();
+ gGL.popMatrix();
}
}
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA))
{
LLVertexBuffer::unbind();
@@ -4429,7 +4455,7 @@ void LLPipeline::renderDebug()
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
gGL.pushMatrix();
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter)
@@ -4450,7 +4476,7 @@ void LLPipeline::renderDebug()
if (bridge)
{
gGL.pushMatrix();
- glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
+ gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix);
}
F32 alpha = llclamp((F32) (size-count)/size, 0.f, 1.f);
@@ -4474,8 +4500,10 @@ void LLPipeline::renderDebug()
}
gGL.flush();
-
- gPipeline.renderPhysicsDisplay();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
}
void LLPipeline::rebuildPools()
@@ -4796,6 +4824,8 @@ void LLPipeline::setupAvatarLights(BOOL for_edit)
{
assertInitialized();
+ gGL.syncMatrices();
+
if (for_edit)
{
LLColor4 diffuse(1.f, 1.f, 1.f, 0.f);
@@ -5024,6 +5054,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
void LLPipeline::setupHWLights(LLDrawPool* pool)
{
assertInitialized();
+ gGL.syncMatrices();
// Ambient
LLColor4 ambient = gSky.getTotalAmbientColor();
@@ -5304,6 +5335,8 @@ void LLPipeline::enableLightsPreview()
{
disableLights();
+ gGL.syncMatrices();
+
glEnable(GL_LIGHTING);
LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor");
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
@@ -6068,10 +6101,10 @@ void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture)
{
LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS);
assertInitialized();
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
mSimplePool->pushBatches(type, mask);
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
}
@@ -6080,25 +6113,25 @@ void apply_cube_face_rotation(U32 face)
switch (face)
{
case 0:
- glRotatef(90.f, 0, 1, 0);
- glRotatef(180.f, 1, 0, 0);
+ gGL.rotatef(90.f, 0, 1, 0);
+ gGL.rotatef(180.f, 1, 0, 0);
break;
case 2:
- glRotatef(-90.f, 1, 0, 0);
+ gGL.rotatef(-90.f, 1, 0, 0);
break;
case 4:
- glRotatef(180.f, 0, 1, 0);
- glRotatef(180.f, 0, 0, 1);
+ gGL.rotatef(180.f, 0, 1, 0);
+ gGL.rotatef(180.f, 0, 0, 1);
break;
case 1:
- glRotatef(-90.f, 0, 1, 0);
- glRotatef(180.f, 1, 0, 0);
+ gGL.rotatef(-90.f, 0, 1, 0);
+ gGL.rotatef(180.f, 1, 0, 0);
break;
case 3:
- glRotatef(90, 1, 0, 0);
+ gGL.rotatef(90, 1, 0, 0);
break;
case 5:
- glRotatef(180, 0, 0, 1);
+ gGL.rotatef(180, 0, 0, 1);
break;
}
}
@@ -6141,8 +6174,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
{
LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM);
if (!(gPipeline.canUseVertexShaders() &&
- sRenderGlow) ||
- (!sRenderDeferred && hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)))
+ sRenderGlow))
{
return;
}
@@ -6177,12 +6209,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
enableLightsFullbright(LLColor4(1,1,1,1));
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
LLGLDisable test(GL_ALPHA_TEST);
@@ -6319,7 +6351,35 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
if (LLPipeline::sRenderDeferred)
{
bool dof_enabled = !LLViewerCamera::getInstance()->cameraUnderWater();
+ bool multisample = gSavedSettings.getU32("RenderFSAASamples") > 1;
+ if (multisample)
+ {
+ //bake out texture2D with RGBL for FXAA shader
+ mFXAABuffer.bindTarget();
+
+ S32 width = mScreen.getWidth();
+ S32 height = mScreen.getHeight();
+ glViewport(0, 0, width, height);
+
+ gGlowCombineFXAAProgram.bind();
+ gGlowCombineFXAAProgram.uniform2f("screen_res", width, height);
+
+ gGL.getTexUnit(0)->bind(&mGlow[1]);
+ gGL.getTexUnit(1)->bind(&mScreen);
+
+ gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.vertex2f(-1,-1);
+ gGL.vertex2f(-1,3);
+ gGL.vertex2f(3,-1);
+ gGL.end();
+
+ gGlowCombineFXAAProgram.unbind();
+ mFXAABuffer.flush();
+ }
+
+ gViewerWindow->setup3DViewport();
+
LLGLSLShader* shader = &gDeferredPostProgram;
if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)
{
@@ -6331,11 +6391,20 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
shader = &gDeferredPostNoDoFProgram;
dof_enabled = false;
}
-
-
+
LLGLDisable blend(GL_BLEND);
bindDeferredShader(*shader);
+ S32 width = mScreen.getWidth();
+ S32 height = mScreen.getHeight();
+
+ F32 scale_x = (F32) width/mFXAABuffer.getWidth();
+ F32 scale_y = (F32) height/mFXAABuffer.getHeight();
+ shader->uniform2f("tc_scale", scale_x, scale_y);
+ shader->uniform2f("rcp_screen_res", 1.f/width*scale_x, 1.f/height*scale_y);
+ shader->uniform4f("rcp_frame_opt", -0.5f/width*scale_x, -0.5f/height*scale_y, 0.5f/width*scale_x, 0.5f/height*scale_y);
+ shader->uniform4f("rcp_frame_opt2", -2.f/width*scale_x, -2.f/height*scale_y, 2.f/width*scale_x, 2.f/height*scale_y);
+
if (dof_enabled)
{
//depth of field focal plane calculations
@@ -6448,17 +6517,25 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
shader->uniform1f("magnification", magnification);
}
- S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
- if (channel > -1)
+ if (multisample)
{
- mScreen.bindTexture(0, channel);
+ S32 channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP, mFXAABuffer.getUsage());
+ if (channel > -1)
+ {
+ mFXAABuffer.bindTexture(0, channel);
+ gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+ }
+ }
+ else
+ {
+ S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
+ if (channel > -1)
+ {
+ mScreen.bindTexture(0, channel);
+ }
}
- //channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE);
- //if (channel > -1)
- //{
- //gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
- //}
+
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
gGL.vertex2f(-1,-1);
@@ -6543,19 +6620,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
}
- if (LLRenderTarget::sUseFBO)
- { //copy depth buffer from mScreen to framebuffer
- LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(),
- 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
- }
-
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
{
if (LLGLSLShader::sNoFixedFunction)
{
- gUIProgram.bind();
+ gSplatTextureRectProgram.bind();
}
gGL.setColorMask(true, false);
@@ -6569,7 +6640,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
gGL.getTexUnit(0)->bind(&mPhysicsDisplay);
- gGL.begin(LLRender::TRIANGLE_STRIP);
+ gGL.begin(LLRender::TRIANGLES);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
gGL.vertex2f(-1,-1);
@@ -6584,15 +6655,22 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
if (LLGLSLShader::sNoFixedFunction)
{
- gUIProgram.unbind();
+ gSplatTextureRectProgram.unbind();
}
+ }
+
+ if (LLRenderTarget::sUseFBO)
+ { //copy depth buffer from mScreen to framebuffer
+ LLRenderTarget::copyContentsToFramebuffer(mScreen, 0, 0, mScreen.getWidth(), mScreen.getHeight(),
+ 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
}
+
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
LLVertexBuffer::unbind();
@@ -6949,6 +7027,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen
shader.uniform1f("lum_scale", gSavedSettings.getF32("RenderLuminanceScale"));
shader.uniform1f("sun_lum_scale", gSavedSettings.getF32("RenderSunLuminanceScale"));
shader.uniform1f("sun_lum_offset", gSavedSettings.getF32("RenderSunLuminanceOffset"));
+ shader.uniform3fv("sun_dir", 1, mTransformedSunDir.mV);
shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail"));
shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange"));
shader.uniform1f("gi_brightness", gSavedSettings.getF32("RenderGIBrightness"));
@@ -7023,28 +7102,30 @@ void LLPipeline::renderDeferredLighting()
glh::matrix4f mat = glh_copy_matrix(gGLModelView);
- F32 vert[] =
- {
- -1,1,
- -1,-3,
- 3,1,
- };
- glVertexPointer(2, GL_FLOAT, 0, vert);
- glColor3f(1,1,1);
+ LLStrider<LLVector3> vert;
+ mDeferredVB->getVertexStrider(vert);
+ LLStrider<LLVector2> tc0;
+ LLStrider<LLVector2> tc1;
+ mDeferredVB->getTexCoord0Strider(tc0);
+ mDeferredVB->getTexCoord1Strider(tc1);
+ vert[0].set(-1,1,0);
+ vert[1].set(-1,-3,0);
+ vert[2].set(3,1,0);
+
{
setupHWLights(NULL); //to set mSunDir;
LLVector4 dir(mSunDir, 0.f);
glh::vec4f tc(dir.mV);
mat.mult_matrix_vec(tc);
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0);
+ mTransformedSunDir.set(tc.v);
}
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
if (gSavedSettings.getBOOL("RenderDeferredSSAO") || gSavedSettings.getS32("RenderShadowDetail") > 0)
{
@@ -7052,7 +7133,7 @@ void LLPipeline::renderDeferredLighting()
{ //paint shadow/SSAO light map (direct lighting lightmap)
LLFastTimer ftm(FTM_SUN_SHADOW);
bindDeferredShader(gDeferredSunProgram, 0);
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
glClearColor(1,1,1,1);
mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
@@ -7083,7 +7164,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7107,7 +7188,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredEdgeProgram.bind();
mEdgeMap.bindTarget();
bindDeferredShader(gDeferredEdgeProgram);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gDeferredEdgeProgram);
mEdgeMap.flush();
}
@@ -7129,7 +7211,8 @@ void LLPipeline::renderDeferredLighting()
gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight());
mLuminanceMap.bindTarget();
bindDeferredShader(gLuminanceGatherProgram);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gLuminanceGatherProgram);
mLuminanceMap.flush();
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true);
@@ -7147,7 +7230,8 @@ void LLPipeline::renderDeferredLighting()
mGIMapPost[0].bindTarget();
bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0, mTrueNoiseMap);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
unbindDeferredShader(gDeferredGIProgram);
mGIMapPost[0].flush();
}
@@ -7172,7 +7256,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7187,7 +7272,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mGIMapPost[0].flush();
@@ -7201,13 +7287,12 @@ void LLPipeline::renderDeferredLighting()
LLFastTimer ftm(FTM_SOFTEN_SHADOW);
//blur lightmap
mDeferredLight[1].bindTarget();
-
glClearColor(1,1,1,1);
mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
bindDeferredShader(gDeferredBlurLightProgram);
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian");
const U32 kern_length = 4;
F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize");
@@ -7235,7 +7320,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
@@ -7243,6 +7328,7 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredBlurLightProgram);
bindDeferredShader(gDeferredBlurLightProgram, 1);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
mDeferredLight[0].bindTarget();
gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f);
@@ -7251,7 +7337,7 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
stop_glerror();
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mDeferredLight[0].flush();
@@ -7259,11 +7345,11 @@ void LLPipeline::renderDeferredLighting()
}
stop_glerror();
- glPopMatrix();
+ gGL.popMatrix();
stop_glerror();
- glMatrixMode(GL_MODELVIEW);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
stop_glerror();
- glPopMatrix();
+ gGL.popMatrix();
stop_glerror();
//copy depth and stencil from deferred screen
@@ -7295,25 +7381,25 @@ void LLPipeline::renderDeferredLighting()
LLGLDisable test(GL_ALPHA_TEST);
//full screen blit
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
- glVertexPointer(2, GL_FLOAT, 0, vert);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
-
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
}
unbindDeferredShader(gDeferredSoftenProgram);
}
- { //render sky
+ { //render non-deferred geometry (fullbright, alpha, etc)
LLGLDisable blend(GL_BLEND);
LLGLDisable stencil(GL_STENCIL_TEST);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
@@ -7354,12 +7440,12 @@ void LLPipeline::renderDeferredLighting()
std::list<LLVector4> light_colors;
LLVertexBuffer::unbind();
+ LLVector4a* v = (LLVector4a*) vert.get();
- F32 v[24];
- glVertexPointer(3, GL_FLOAT, 0, v);
-
{
bindDeferredShader(gDeferredLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter)
{
@@ -7414,15 +7500,15 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
- v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000
- v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001
- v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010
- v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011
+ v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
+ v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
+ v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
+ v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011
- v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
- v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
- v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
- v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
+ v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+ v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+ v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+ v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
if (camera->getOrigin().mV[0] > c[0] + s + 0.2f ||
camera->getOrigin().mV[0] < c[0] - s - 0.2f ||
@@ -7441,8 +7527,13 @@ void LLPipeline::renderDeferredLighting()
}
LLFastTimer ftm(FTM_LOCAL_LIGHTS);
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+ //glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
+ gDeferredLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredLightProgram.uniform1f("size", s*s);
+ gDeferredLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
+ //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+ gGL.syncMatrices();
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
stop_glerror();
@@ -7469,6 +7560,8 @@ void LLPipeline::renderDeferredLighting()
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
bindDeferredShader(gDeferredSpotLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
@@ -7497,18 +7590,21 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
- v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000
- v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001
- v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010
- v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011
+ v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
+ v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
+ v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
+ v[3].set(c[0]-s,c[1]+s,c[2]+s); // 3 - 0011
- v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100
- v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101
- v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110
- v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111
-
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
+ v[4].set(c[0]+s,c[1]-s,c[2]-s); // 4 - 0100
+ v[5].set(c[0]+s,c[1]-s,c[2]+s); // 5 - 0101
+ v[6].set(c[0]+s,c[1]+s,c[2]-s); // 6 - 0110
+ v[7].set(c[0]+s,c[1]+s,c[2]+s); // 7 - 0111
+
+ gDeferredSpotLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredSpotLightProgram.uniform1f("size", s*s);
+ gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
+ gGL.syncMatrices();
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
}
@@ -7516,17 +7612,24 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredSpotLightProgram);
}
+ //reset mDeferredVB to fullscreen triangle
+ vert[0].set(-1,1,0);
+ vert[1].set(-1,-3,0);
+ vert[2].set(3,1,0);
+
{
bindDeferredShader(gDeferredMultiLightProgram);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
LLGLDepthTest depth(GL_FALSE);
//full screen blit
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
U32 count = 0;
@@ -7534,7 +7637,7 @@ void LLPipeline::renderDeferredLighting()
LLVector4 light[max_count];
LLVector4 col[max_count];
- glVertexPointer(2, GL_FLOAT, 0, vert);
+// glVertexPointer(2, GL_FLOAT, 0, vert);
F32 far_z = 0.f;
@@ -7557,7 +7660,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiLightProgram.uniform1f("far_z", far_z);
far_z = 0.f;
count = 0;
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
}
@@ -7567,6 +7671,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
+
for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter)
{
LLFastTimer ftm(FTM_PROJECTORS);
@@ -7588,17 +7694,19 @@ void LLPipeline::renderDeferredLighting()
LLColor3 col = volume->getLightColor();
col *= volume->getLightIntensity();
- glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
- glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ gDeferredMultiSpotLightProgram.uniform3fv("center", 1, tc.v);
+ gDeferredMultiSpotLightProgram.uniform1f("size", s*s);
+ gDeferredMultiSpotLightProgram.uniform3fv("color", 1, col.mV);
+ gDeferredMultiSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
unbindDeferredShader(gDeferredMultiSpotLightProgram);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
}
}
@@ -7623,23 +7731,23 @@ void LLPipeline::renderDeferredLighting()
bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]);
gDeferredPostProgram.bind();
-
+ mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
LLVertexBuffer::unbind();
- glVertexPointer(2, GL_FLOAT, 0, vert);
- glColor3f(1,1,1);
+// glVertexPointer(2, GL_FLOAT, 0, vert);
+ gGL.diffuseColor3f(1,1,1);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
-
- glDrawArrays(GL_TRIANGLES, 0, 3);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
unbindDeferredShader(gDeferredPostProgram);
}
@@ -7977,7 +8085,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
stop_glerror();
- glPushMatrix();
+ gGL.pushMatrix();
mat.set_scale(glh::vec3f(1,1,-1));
mat.set_translate(glh::vec3f(0,0,height*2.f));
@@ -7987,7 +8095,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
mat = current * mat;
glh_set_current_modelview(mat);
- glLoadMatrixf(mat.m);
+ gGL.loadMatrix(mat.m);
LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE);
@@ -8065,7 +8173,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gPipeline.popRenderTypeMask();
}
glCullFace(GL_BACK);
- glPopMatrix();
+ gGL.popMatrix();
mWaterRef.flush();
glh_set_current_modelview(current);
LLPipeline::sUseOcclusion = occlusion;
@@ -8246,12 +8354,12 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
stateSort(shadow_cam, result);
//generate shadow map
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadMatrixf(proj.m);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadMatrixd(gGLModelView);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadMatrix(proj.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadMatrix(gGLModelView);
stop_glerror();
gGLLastMatrix = NULL;
@@ -8262,12 +8370,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
- glColor4f(1,1,1,1);
stop_glerror();
-
- gGL.setColorMask(false, false);
//glCullFace(GL_FRONT);
@@ -8278,6 +8382,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
{ //occlusion program is general purpose depth-only no-textures
gOcclusionProgram.bind();
}
+
+ gGL.diffuseColor4f(1,1,1,1);
+ gGL.setColorMask(false, false);
+
LLFastTimer ftm(FTM_SHADOW_SIMPLE);
gGL.getTexUnit(0)->disable();
for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i)
@@ -8307,14 +8415,16 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gDeferredShadowAlphaMaskProgram.bind();
gDeferredShadowAlphaMaskProgram.setAlphaRange(0.6f, 1.f);
renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE);
- glColor4f(1,1,1,1);
+ gDeferredTreeShadowProgram.bind();
+ gDeferredTreeShadowProgram.setAlphaRange(0.6f, 1.f);
renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE);
}
//glCullFace(GL_BACK);
+ gDeferredShadowProgram.bind();
gGLLastMatrix = NULL;
- glLoadMatrixd(gGLModelView);
+ gGL.loadMatrix(gGLModelView);
doOcclusion(shadow_cam);
if (use_shader)
@@ -8324,10 +8434,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gGL.setColorMask(true, true);
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
gGLLastMatrix = NULL;
LLPipeline::sUseOcclusion = occlude;
@@ -8654,12 +8764,12 @@ void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<L
LLGLEnable cull(GL_CULL_FACE);
//generate GI map
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadMatrixf(proj.m);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadMatrixf(view.m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadMatrix(proj.m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadMatrix(view.m);
stop_glerror();
gGLLastMatrix = NULL;
@@ -8673,10 +8783,10 @@ void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<L
mGIMap.flush();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
gGLLastMatrix = NULL;
LLPipeline::sUseOcclusion = occlude;
@@ -9461,10 +9571,10 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
{
glh_set_current_modelview(view[1]);
glh_set_current_projection(proj[1]);
- glLoadMatrixf(view[1].m);
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(proj[1].m);
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadMatrix(view[1].m);
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadMatrix(proj[1].m);
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
gGL.setColorMask(true, false);
@@ -9596,24 +9706,24 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
F32 distance = (pos-camera.getOrigin()).length();
F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
F32 aspect = tdim.mV[0]/tdim.mV[1];
glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
glh_set_current_projection(persp);
- glLoadMatrixf(persp.m);
+ gGL.loadMatrix(persp.m);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
glh::matrix4f mat;
camera.getOpenGLTransform(mat.m);
mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat;
- glLoadMatrixf(mat.m);
+ gGL.loadMatrix(mat.m);
glh_set_current_modelview(mat);
glClearColor(0.0f,0.0f,0.0f,0.0f);
@@ -9681,14 +9791,19 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.flush();
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
static const F32 clip_plane = 0.99999f;
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
gGL.color4ub(64,64,64,255);
gGL.begin(LLRender::QUADS);
gGL.vertex3f(-1, -1, clip_plane);
@@ -9698,9 +9813,14 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.end();
gGL.flush();
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.unbind();
+ }
+
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
}
avatar->mImpostor.flush();
@@ -9714,10 +9834,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
sShadowRender = FALSE;
popRenderTypeMask();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
avatar->mNeedsImpostorUpdate = FALSE;
avatar->cacheImpostorValues();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 3f0640221e..ab58046ba9 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -530,6 +530,7 @@ public:
LLRenderTarget mScreen;
LLRenderTarget mUIScreen;
LLRenderTarget mDeferredScreen;
+ LLRenderTarget mFXAABuffer;
LLRenderTarget mEdgeMap;
LLRenderTarget mDeferredDepth;
LLRenderTarget mDeferredLight[3];
@@ -539,6 +540,9 @@ public:
LLRenderTarget mHighlight;
LLRenderTarget mPhysicsDisplay;
+ //utility buffer for rendering post effects, gets abused by renderDeferredLighting
+ LLPointer<LLVertexBuffer> mDeferredVB;
+
//sun shadow map
LLRenderTarget mShadow[6];
std::vector<LLVector3> mShadowFrustPoints[4];
@@ -584,6 +588,7 @@ public:
LLColor4 mSunDiffuse;
LLVector3 mSunDir;
+ LLVector3 mTransformedSunDir;
BOOL mInitialized;
BOOL mVertexShadersEnabled;
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index 3dd394bac1..87f1fcf0a1 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -191,34 +191,36 @@ Dummy Name replaced at run time
top="5"
width="435"
word_wrap="true">
-3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
-APR Copyright (C) 2000-2004 The Apache Software Foundation
-Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
-cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
-DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
-expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
-FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
-GL Copyright (C) 1999-2004 Brian Paul.
-GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
-google-perftools Copyright (c) 2005, Google Inc.
-Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
-jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
-jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
-ogg/vorbis Copyright (C) 2001, Xiphophorus
-OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
-PCRE Copyright (c) 1997-2008 University of Cambridge
-SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
-SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
-xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
-zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
-google-perftools Copyright (c) 2005, Google Inc.
+ 3Dconnexion SDK Copyright (C) 1992-2007 3Dconnexion
+ APR Copyright (C) 2000-2004 The Apache Software Foundation
+ Collada DOM Copyright 2005 Sony Computer Entertainment Inc.
+ cURL Copyright (C) 1996-2002, Daniel Stenberg, (daniel@haxx.se)
+ DBus/dbus-glib Copyright (C) 2002, 2003 CodeFactory AB / Copyright (C) 2003, 2004 Red Hat, Inc.
+ expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+ FreeType Copyright (C) 1996-2002, The FreeType Project (www.freetype.org).
+ GL Copyright (C) 1999-2004 Brian Paul.
+ GLOD Copyright (C) 2003-04 Jonathan Cohen, Nat Duca, Chris Niski, Johns Hopkins University and David Luebke, Brenden Schubert, University of Virginia.
+ google-perftools Copyright (c) 2005, Google Inc.
+ Havok.com(TM) Copyright (C) 1999-2001, Telekinesys Research Limited.
+ jpeg2000 Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW)
+ jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+ ogg/vorbis Copyright (C) 2001, Xiphophorus
+ OpenSSL Copyright (C) 1998-2002 The OpenSSL Project.
+ PCRE Copyright (c) 1997-2008 University of Cambridge
+ SDL Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
+ SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ xmlrpc-epi Copyright (C) 2000 Epinions, Inc.
+ zlib Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler.
+ google-perftools Copyright (c) 2005, Google Inc.
-Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
+ Second Life Viewer uses Havok (TM) Physics. (c)Copyright 1999-2010 Havok.com Inc. (and its Licensors). All Rights Reserved. See www.havok.com for details.
-All rights reserved. See licenses.txt for details.
+ This software contains source code provided by NVIDIA Corporation.
-Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
- </text_editor>
+ All rights reserved. See licenses.txt for details.
+
+ Voice chat Audio coding: Polycom(R) Siren14(TM) (ITU-T Rec. G.722.1 Annex C)
+ </text_editor>
</panel>
</tab_container>
</floater>