diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-04-18 05:30:44 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-04-18 05:30:44 -0700 |
commit | f76b3d7e7d778fec7f082c46491197cac9867a50 (patch) | |
tree | e03fa2b4f83f244cd81d77712df0cfdf9456acef | |
parent | 1c3c737a83d9634fd0c47502b4c94b7613280d53 (diff) |
NORSPEC-125 fiddle with ifdefs in alpha shaders again in hopes of linking on mobile geforce macs
6 files changed, 50 insertions, 49 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 057c0a1ec9..713aae9187 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -25,10 +25,6 @@ #extension GL_ARB_texture_rectangle : enable -#define INDEXED 1 -#define NON_INDEXED 2 -#define NON_INDEXED_NO_COLOR 3 - #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; #else @@ -37,11 +33,13 @@ out vec4 frag_color; uniform sampler2DRect depthMap; -#if !INDEX_MODE || INDEX_MODE_NO_COLOR +#ifndef INDEX_MODE +#ifndef INDEX_MODE_USE_COLOR uniform sampler2D diffuseMap; #endif +#endif -#if INDEX_MODE +#ifdef INDEX_MODE vec4 diffuseLookup(vec2 texcoord); #endif @@ -61,7 +59,7 @@ VARYING vec2 vary_texcoord2; VARYING vec3 vary_norm; VARYING mat3 vary_rotation; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR VARYING vec4 vertex_color; #endif @@ -124,16 +122,16 @@ void main() vec4 pos = vec4(vary_position, 1.0); -#if INDEX_MODE +#ifdef INDEX_MODE vec4 diff= diffuseLookup(vary_texcoord0.xy); #else vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy); #endif -#if INDEX_MODE_NO_COLOR - float vertex_color_alpha = 1.0; -#else +#ifdef INDEX_MODE_USE_COLOR float vertex_color_alpha = vertex_color.a; +#else + float vertex_color_alpha = 1.0; #endif vec3 normal = texture2D(bumpMap, vary_texcoord1.xy).xyz * 2 - 1; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 7506123a94..55d15ce847 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -34,7 +34,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -#if INDEX_MODE +#ifdef INDEX_MODE void passTextureIndex(); #endif ATTRIBUTE vec3 normal; @@ -44,7 +44,7 @@ ATTRIBUTE vec3 binormal; ATTRIBUTE vec2 texcoord1; ATTRIBUTE vec2 texcoord2; -#if HAS_SKIN +#ifdef HAS_SKIN mat4 getObjectSkinnedTransform(); #elif IS_AVATAR_SKIN mat4 getSkinnedTransform(); @@ -66,7 +66,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR VARYING vec4 vertex_color; #endif @@ -127,7 +127,7 @@ void main() vec4 pos; vec3 norm; //transform vertex -#if HAS_SKIN +#ifdef HAS_SKIN mat4 trans = getObjectSkinnedTransform(); trans = modelview_matrix * trans; @@ -137,7 +137,8 @@ void main() norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz); vec4 frag_pos = projection_matrix * pos; gl_Position = frag_pos; -#elif IS_AVATAR_SKIN +#else +#ifdef IS_AVATAR_SKIN mat4 trans = getSkinnedTransform(); vec4 pos_in = vec4(position.xyz, 1.0); pos.x = dot(trans[0], pos_in); @@ -158,10 +159,12 @@ void main() pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif +#endif vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy; vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy; -#if INDEX_MODE + +#ifdef INDEX_MODE passTextureIndex(); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; #else @@ -197,17 +200,18 @@ void main() vary_directional.rgb = atmosAffectDirectionalLight(1.0f); col.rgb = col.rgb*diffuse_color.rgb; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR vertex_color = col; #endif -#if HAS_SKIN +#ifdef HAS_SKIN vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); -#elif IS_AVATAR_SKIN +#else +#ifdef IS_AVATAR_SKIN vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #else pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #endif - +#endif } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index e2fd52b8ad..da47d60049 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -25,10 +25,6 @@ #extension GL_ARB_texture_rectangle : enable -#define INDEXED 1 -#define NON_INDEXED 2 -#define NON_INDEXED_NO_COLOR 3 - #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; #else @@ -41,7 +37,7 @@ uniform sampler2DShadow shadowMap2; uniform sampler2DShadow shadowMap3; uniform sampler2DRect depthMap; -#if !INDEX_MODE || INDEX_MODE_NO_COLOR +#ifndef INDEX_MODE uniform sampler2D diffuseMap; #endif @@ -62,7 +58,7 @@ VARYING vec2 vary_texcoord2; VARYING vec3 vary_norm; VARYING mat3 vary_rotation; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR VARYING vec4 vertex_color; #endif @@ -210,16 +206,16 @@ void main() } vec4 diff; -#if INDEX_MODE +#ifdef INDEX_MODE diff = diffuseLookup(vary_texcoord0.xy); #else diff = texture2D(diffuseMap,vary_texcoord0.xy); #endif -#if INDEX_MODE_NO_COLOR - float vertex_color_alpha = 1.0; -#else +#ifdef INDEX_MODE_USE_COLOR float vertex_color_alpha = vertex_color.a; +#else + float vertex_color_alpha = 1.0; #endif vec3 normal = texture2D(bumpMap, vary_texcoord1.xy).xyz * 2 - 1; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 7c71e605c7..bc5bbd42c7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -23,10 +23,6 @@ * $/LicenseInfo$ */ -#define INDEXED 1 -#define NON_INDEXED 2 -#define NON_INDEXED_NO_COLOR 3 - uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 projection_matrix; @@ -34,7 +30,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -#if INDEX_MODE +#ifdef INDEX_MODE void passTextureIndex(); #endif ATTRIBUTE vec3 normal; @@ -45,11 +41,13 @@ ATTRIBUTE vec2 texcoord1; ATTRIBUTE vec2 texcoord2; -#if HAS_SKIN +#ifdef HAS_SKIN mat4 getObjectSkinnedTransform(); -#elif IS_AVATAR_SKIN +#else +#ifdef IS_AVATAR_SKIN mat4 getSkinnedTransform(); #endif +#endif vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -67,7 +65,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR VARYING vec4 vertex_color; #endif @@ -129,7 +127,7 @@ void main() vec3 norm; //transform vertex -#if HAS_SKIN +#ifdef HAS_SKIN mat4 trans = getObjectSkinnedTransform(); trans = modelview_matrix * trans; @@ -139,7 +137,8 @@ void main() norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz); vec4 frag_pos = projection_matrix * pos; gl_Position = frag_pos; -#elif IS_AVATAR_SKIN +#else +#ifdef IS_AVATAR_SKIN mat4 trans = getSkinnedTransform(); vec4 pos_in = vec4(position.xyz, 1.0); pos.x = dot(trans[0], pos_in); @@ -160,9 +159,11 @@ void main() pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif +#endif + vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy; vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy; -#if INDEX_MODE +#ifdef INDEX_MODE passTextureIndex(); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; #else @@ -198,16 +199,19 @@ void main() col.rgb = col.rgb*diffuse_color.rgb; -#if !INDEX_MODE_NO_COLOR +#ifdef INDEX_MODE_USE_COLOR vertex_color = col; #endif -#if HAS_SKIN +#ifdef HAS_SKIN vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); -#elif IS_AVATAR_SKIN +#else +#ifdef IS_AVATAR_SKIN vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #else pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #endif +#endif + } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 92533f64ab..2a2ca74e5d 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1221,10 +1221,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE", "0"); - gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE_NO_COLOR", "0"); + gDeferredSkinnedAlphaProgram.addPermutation("INDEX_MODE_USE_COLOR", "1"); gDeferredSkinnedAlphaProgram.addPermutation("HAS_SKIN", "1"); - gDeferredSkinnedAlphaProgram.addPermutation("IS_AVATAR_SKIN", "0"); success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL); // Hack to include uniforms for lighting without linking in lighting file @@ -1260,9 +1258,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode)); bool has_skin = i & 0x10; - gDeferredMaterialProgram[i].addPermutation("HAS_SKIN",has_skin ? "1" : "0"); if (has_skin) { + gDeferredMaterialProgram[i].addPermutation("HAS_SKIN", "1"); gDeferredMaterialProgram[i].mFeatures.hasObjectSkinning = true; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c074a0e16e..75c6480a95 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -9488,6 +9488,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //currently used for amount to extrude frusta corners for constructing shadow frusta LLVector3 n = RenderShadowNearDist; + (void)n; //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; //put together a universal "near clip" plane for shadow frusta |