From 97277e74a9d966ed441e51f844f9012f55cca3dc Mon Sep 17 00:00:00 2001 From: Jonathan Goodman Date: Mon, 14 Nov 2022 18:12:22 +0000 Subject: Merged in SL-18332 (pull request #1194) First pass of Screen Space Reflections Approved-by: Dave Parks --- .../shaders/class1/deferred/aoUtil.glsl | 14 +-- .../shaders/class1/deferred/blurLightF.glsl | 10 +- .../shaders/class1/deferred/blurLightV.glsl | 6 +- .../app_settings/shaders/class1/deferred/cofF.glsl | 10 +- .../shaders/class1/deferred/deferredUtil.glsl | 27 +++-- .../shaders/class1/deferred/dofCombineF.glsl | 18 ++-- .../shaders/class1/deferred/luminanceF.glsl | 4 +- .../shaders/class1/deferred/luminanceV.glsl | 2 +- .../shaders/class1/deferred/multiPointLightF.glsl | 14 +-- .../shaders/class1/deferred/multiPointLightV.glsl | 4 +- .../shaders/class1/deferred/multiSpotLightF.glsl | 16 +-- .../shaders/class1/deferred/pointLightF.glsl | 15 +-- .../shaders/class1/deferred/postDeferredF.glsl | 16 +-- .../class1/deferred/postDeferredGammaCorrect.glsl | 4 +- .../class1/deferred/postDeferredNoDoFF.glsl | 6 +- .../shaders/class1/deferred/postDeferredNoTCV.glsl | 6 +- .../shaders/class1/deferred/postDeferredV.glsl | 6 +- .../shaders/class1/deferred/postgiF.glsl | 14 +-- .../class1/deferred/screenSpaceReflPostF.glsl | 57 ++++++++++ .../class1/deferred/screenSpaceReflPostV.glsl | 39 +++++++ .../class1/deferred/screenSpaceReflUtil.glsl | 120 +++++++++++++++++++++ .../shaders/class1/deferred/shadowUtil.glsl | 4 +- .../shaders/class1/deferred/softenLightF.glsl | 19 ++-- .../shaders/class1/deferred/softenLightV.glsl | 6 +- .../shaders/class1/deferred/spotLightF.glsl | 15 ++- .../shaders/class1/deferred/sunLightSSAOF.glsl | 2 +- .../shaders/class1/deferred/sunLightV.glsl | 6 +- .../shaders/class1/effects/glowExtractF.glsl | 4 +- .../shaders/class1/effects/glowExtractV.glsl | 4 +- .../app_settings/shaders/class1/effects/glowV.glsl | 2 +- .../class1/interface/downsampleDepthRectF.glsl | 20 ++-- .../shaders/class1/interface/downsampleDepthV.glsl | 2 +- .../shaders/class1/interface/glowcombineF.glsl | 4 +- .../shaders/class1/interface/glowcombineFXAAF.glsl | 4 +- .../shaders/class1/interface/glowcombineFXAAV.glsl | 3 +- .../shaders/class1/interface/glowcombineV.glsl | 2 +- .../shaders/class1/interface/radianceGenF.glsl | 3 +- .../shaders/class1/interface/reflectionmipF.glsl | 15 ++- .../class1/interface/splattexturerectF.glsl | 4 +- 39 files changed, 369 insertions(+), 158 deletions(-) create mode 100644 indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl (limited to 'indra/newview/app_settings/shaders/class1') diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl index 23adbded5e..f93ed6bc6d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl @@ -24,8 +24,8 @@ */ uniform sampler2D noiseMap; -uniform sampler2DRect normalMap; -uniform sampler2DRect depthMap; +uniform sampler2D normalMap; +uniform sampler2D depthMap; uniform float ssao_radius; uniform float ssao_max_radius; @@ -38,23 +38,19 @@ uniform vec2 screen_res; vec2 getScreenCoordinateAo(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; - if (screen_res.x > 0 && screen_res.y > 0) - { - sc /= screen_res; - } return sc - vec2(1.0, 1.0); } float getDepthAo(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen).r; + float depth = texture2D(depthMap, pos_screen).r; return depth; } vec4 getPositionAo(vec2 pos_screen) { float depth = getDepthAo(pos_screen); - vec2 sc = getScreenCoordinateAo(pos_screen); + vec2 sc = (pos_screen); vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); vec4 pos = inv_proj * ndc; pos /= pos.w; @@ -83,7 +79,7 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen) { float ret = 1.0; vec3 pos_world = pos.xyz; - vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy/128.0).xy; + vec2 noise_reflect = texture2D(noiseMap, pos_screen.xy).xy; float angle_hidden = 0.0; float points = 0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index fa3634f3b6..9bead273ff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -33,8 +33,8 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect normalMap; -uniform sampler2DRect lightMap; +uniform sampler2D normalMap; +uniform sampler2D lightMap; uniform float dist_factor; uniform float blur_size; @@ -52,7 +52,7 @@ void main() vec2 tc = vary_fragcoord.xy; vec3 norm = getNorm(tc); vec3 pos = getPosition(tc).xyz; - vec4 ccol = texture2DRect(lightMap, tc).rgba; + vec4 ccol = texture2D(lightMap, tc).rgba; vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); @@ -89,7 +89,7 @@ void main() if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DRect(lightMap, samptc)*k[i].xyxx; + col += texture2D(lightMap, samptc)*k[i].xyxx; defined_weight += k[i].xy; } } @@ -103,7 +103,7 @@ void main() if (d*d <= pointplanedist_tolerance_pow2) { - col += texture2DRect(lightMap, samptc)*k[i].xyxx; + col += texture2D(lightMap, samptc)*k[i].xyxx; defined_weight += k[i].xy; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index 212f7e56ad..5e0f01981b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ -uniform mat4 modelview_projection_matrix; - ATTRIBUTE vec3 position; VARYING vec2 vary_fragcoord; @@ -33,7 +31,7 @@ uniform vec2 screen_res; void main() { //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec4 pos = vec4(position.xyz, 1.0); gl_Position = pos; - vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; + vary_fragcoord = (pos.xy*0.5+0.5); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 079d8458c9..1e640d95ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -33,8 +33,8 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect depthMap; +uniform sampler2D diffuseRect; +uniform sampler2D depthMap; uniform sampler2D bloomMap; uniform float depth_cutoff; @@ -69,19 +69,19 @@ void main() { vec2 tc = vary_fragcoord.xy; - float z = texture2DRect(depthMap, tc).r; + float z = texture2D(depthMap, tc).r; z = z*2.0-1.0; vec4 ndc = vec4(0.0, 0.0, z, 1.0); vec4 p = inv_proj*ndc; float depth = p.z/p.w; - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy); float sc = calc_cof(depth); sc = min(sc, max_cof); sc = max(sc, -max_cof); - vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); + vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy); frag_color.rgb = diff.rgb + bloom.rgb; frag_color.a = sc/max_cof*0.5+0.5; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 1a96ee0736..c87e754eca 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -48,8 +48,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -uniform sampler2DRect normalMap; -uniform sampler2DRect depthMap; +uniform sampler2D normalMap; +uniform sampler2D depthMap; uniform sampler2D projectionMap; // rgba uniform sampler2D brdfLut; @@ -138,10 +138,6 @@ bool clipProjectedLightVars(vec3 light_center, vec3 pos, out float dist, out flo vec2 getScreenCoordinate(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; - if (screen_res.x > 0 && screen_res.y > 0) - { - sc /= screen_res; - } return sc - vec2(1.0, 1.0); } @@ -149,7 +145,7 @@ vec2 getScreenCoordinate(vec2 screenpos) // Method #4: Spheremap Transform, Lambert Azimuthal Equal-Area projection vec3 getNorm(vec2 screenpos) { - vec2 enc = texture2DRect(normalMap, screenpos.xy).xy; + vec2 enc = texture2D(normalMap, screenpos.xy).xy; vec2 fenc = enc*4-2; float f = dot(fenc,fenc); float g = sqrt(1-f/4); @@ -175,7 +171,7 @@ vec3 getNormalFromPacked(vec4 packedNormalEnvIntensityFlags) // See: C++: addDeferredAttachments(), GLSL: softenLightF vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity) { - vec4 packedNormalEnvIntensityFlags = texture2DRect(normalMap, screenpos.xy); + vec4 packedNormalEnvIntensityFlags = texture2D(normalMap, screenpos.xy); n = getNormalFromPacked( packedNormalEnvIntensityFlags ); envIntensity = packedNormalEnvIntensityFlags.z; return packedNormalEnvIntensityFlags; @@ -188,9 +184,14 @@ float linearDepth(float d, float znear, float zfar) return znear * 2.0 * zfar / (zfar + znear - d * (zfar - znear)); } +float linearDepth01(float d, float znear, float zfar) +{ + return linearDepth(d, znear, zfar) / zfar; +} + float getDepth(vec2 pos_screen) { - float depth = texture2DRect(depthMap, pos_screen).r; + float depth = texture2D(depthMap, pos_screen).r; return depth; } @@ -333,6 +334,14 @@ vec4 getPositionWithDepth(vec2 pos_screen, float depth) return vec4(getPositionWithNDC(ndc), 1.0); } +vec2 getScreenCoord(vec4 clip) +{ + vec4 ndc = clip; + ndc.xyz /= clip.w; + vec2 screen = vec2( ndc.xy * 0.5 ); + screen += 0.5; + return screen; +} vec2 getScreenXY(vec4 clip) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index 8d48bb016b..d9c0e590c8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -33,8 +33,8 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect lightMap; +uniform sampler2D diffuseRect; +uniform sampler2D lightMap; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -46,12 +46,12 @@ uniform float dof_height; VARYING vec2 vary_fragcoord; -vec4 dofSample(sampler2DRect tex, vec2 tc) +vec4 dofSample(sampler2D tex, vec2 tc) { tc.x = min(tc.x, dof_width); tc.y = min(tc.y, dof_height); - return texture2DRect(tex, tc); + return texture2D(tex, tc); } void main() @@ -60,7 +60,7 @@ void main() vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale); - vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy); + vec4 diff = texture2D(lightMap, vary_fragcoord.xy); float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0); @@ -69,10 +69,10 @@ void main() float sc = a/res_scale; vec4 col; - col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc)); - col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc)); - col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc)); - col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)); + col = texture2D(lightMap, vary_fragcoord.xy+vec2(sc,sc)/screen_res); + col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,sc)/screen_res); + col += texture2D(lightMap, vary_fragcoord.xy+vec2(sc,-sc)/screen_res); + col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)/screen_res); diff = mix(diff, col*0.25, a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index be1003a7e0..185c1150ef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -31,10 +31,10 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseMap; +uniform sampler2D diffuseMap; VARYING vec2 vary_fragcoord; void main() { - frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy); + frag_color = texture2D(diffuseMap, vary_fragcoord.xy); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index f2dc60aa5d..5488a63c6a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -39,7 +39,7 @@ void main() vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); gl_Position = pos; - vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; + vary_fragcoord = (pos.xy * 0.5 + 0.5); vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 0ae4bbfc5d..8feeff848b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -33,9 +33,9 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect depthMap; -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; +uniform sampler2D depthMap; +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; uniform sampler2D noiseMap; uniform sampler2D lightFunc; @@ -54,6 +54,8 @@ VARYING vec4 vary_fragcoord; vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 c); +float getDepth(vec2 tc); +vec2 getScreenCoord(vec4 clip); void main() { @@ -62,7 +64,7 @@ void main() #endif vec3 out_col = vec3(0, 0, 0); - vec2 frag = (vary_fragcoord.xy * 0.5 + 0.5) * screen_res; + vec2 frag = getScreenCoord(vary_fragcoord); vec3 pos = getPosition(frag.xy).xyz; if (pos.z < far_z) { @@ -71,8 +73,8 @@ void main() vec3 norm = getNorm(frag.xy); - vec4 spec = texture2DRect(specularRect, frag.xy); - vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; + vec4 spec = texture2D(specularRect, frag.xy); + vec3 diff = texture2D(diffuseRect, frag.xy).rgb; float noise = texture2D(noiseMap, frag.xy / 128.0).b; vec3 npos = normalize(-pos); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index eefefa640d..d71dc76423 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ -uniform mat4 modelview_projection_matrix; - ATTRIBUTE vec3 position; VARYING vec4 vary_fragcoord; @@ -32,7 +30,7 @@ VARYING vec4 vary_fragcoord; void main() { //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec4 pos = vec4(position.xyz, 1.0); vary_fragcoord = pos; gl_Position = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 8dcc18080d..42a52d7908 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -38,10 +38,10 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; +uniform sampler2D depthMap; +uniform sampler2D normalMap; uniform sampler2D noiseMap; uniform sampler2D projectionMap; uniform sampler2D lightFunc; @@ -72,6 +72,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 c); +float getDepth(vec2 tc); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -137,7 +138,6 @@ void main() vec4 frag = vary_fragcoord; frag.xyz /= frag.w; frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; vec3 lv = center.xyz-pos.xyz; @@ -148,7 +148,7 @@ void main() discard; } - float envIntensity = texture2DRect(normalMap, frag.xy).z; + float envIntensity = texture2D(normalMap, frag.xy).z; vec3 norm = getNorm(frag.xy); float l_dist = -dot(lv, proj_n); @@ -180,7 +180,7 @@ void main() float da = dot(norm, lv); - vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; vec3 dlit = vec3(0, 0, 0); @@ -220,7 +220,7 @@ void main() } - vec4 spec = texture2DRect(specularRect, frag.xy); + vec4 spec = texture2D(specularRect, frag.xy); if (spec.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 5bb034d5c1..40a4f86c37 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -33,12 +33,12 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect normalMap; +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; +uniform sampler2D normalMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; -uniform sampler2DRect depthMap; +uniform sampler2D depthMap; uniform vec3 env_mat[3]; uniform float sun_wash; @@ -57,6 +57,7 @@ uniform vec4 viewport; vec3 getNorm(vec2 pos_screen); vec4 getPosition(vec2 pos_screen); +float getDepth(vec2 pos); vec3 srgb_to_linear(vec3 c); void main() @@ -64,7 +65,6 @@ void main() vec4 frag = vary_fragcoord; frag.xyz /= frag.w; frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; vec3 lv = trans_center.xyz-pos; @@ -88,7 +88,7 @@ void main() float noise = texture2D(noiseMap, frag.xy/128.0).b; - vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 col = texture2D(diffuseRect, frag.xy).rgb; float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); @@ -99,7 +99,7 @@ void main() col = color.rgb*lit*col; - vec4 spec = texture2DRect(specularRect, frag.xy); + vec4 spec = texture2D(specularRect, frag.xy); if (spec.a > 0.0) { lit = min(da*6.0, 1.0) * dist_atten; @@ -125,6 +125,7 @@ void main() { discard; } + final_color.rgb = vec3(getDepth(frag.xy)); frag_color.rgb = col; frag_color.a = 0.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index f06f8c870b..5ca39d6966 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -33,7 +33,7 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; +uniform sampler2D diffuseRect; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -44,7 +44,7 @@ VARYING vec2 vary_fragcoord; void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc) { - vec4 s = texture2DRect(diffuseRect, tc); + vec4 s = texture2D(diffuseRect, tc); float sc = abs(s.a*2.0-1.0)*max_cof; @@ -63,7 +63,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc) void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc) { - vec4 s = texture2DRect(diffuseRect, tc); + vec4 s = texture2D(diffuseRect, tc); float wg = 0.25; @@ -79,7 +79,7 @@ void main() { vec2 tc = vary_fragcoord.xy; - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); + vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy); { float w = 1.0; @@ -93,14 +93,14 @@ void main() { while (sc > 0.5) { - int its = int(max(1.0,(sc*3.7))); + int its = int(max(1.0,(sc*3.7))); for (int i=0; i nearPlaneZ) ? + (nearPlaneZ - csOrig.z) / csDir.z : maxDistance; + vec3 csEndPoint = csOrig + csDir * rayLength; + + // Project into homogeneous clip space + vec4 H0 = proj * vec4(csOrig, 1.0); + vec4 H1 = proj * vec4(csEndPoint, 1.0); + float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w; + + // The interpolated homogeneous version of the camera-space points + vec3 Q0 = csOrig * k0, Q1 = csEndPoint * k1; + + // Screen-space endpoints + vec2 P0 = H0.xy * k0, P1 = H1.xy * k1; + + // If the line is degenerate, make it cover at least one pixel + // to avoid handling zero-pixel extent as a special case later + P1 += vec2((distanceSquared(P0, P1) < 0.0001) ? 0.01 : 0.0); + vec2 delta = P1 - P0; + + // Permute so that the primary iteration is in x to collapse + // all quadrant-specific DDA cases later + bool permute = false; + if (abs(delta.x) < abs(delta.y)) { + // This is a more-vertical line + permute = true; delta = delta.yx; P0 = P0.yx; P1 = P1.yx; + } + + float stepDir = sign(delta.x); + float invdx = stepDir / delta.x; + + // Track the derivatives of Q and k + vec3 dQ = (Q1 - Q0) * invdx; + float dk = (k1 - k0) * invdx; + vec2 dP = vec2(stepDir, delta.y * invdx); + + // Scale derivatives by the desired pixel stride and then + // offset the starting values by the jitter fraction + dP *= stride; dQ *= stride; dk *= stride; + P0 += dP * jitter; Q0 += dQ * jitter; k0 += dk * jitter; + + // Slide P from P0 to P1, (now-homogeneous) Q from Q0 to Q1, k from k0 to k1 + vec3 Q = Q0; + + // Adjust end condition for iteration direction + float end = P1.x * stepDir; + + float k = k0, stepCount = 0.0, prevZMaxEstimate = csOrig.z; + float rayZMin = prevZMaxEstimate, rayZMax = prevZMaxEstimate; + float sceneZMax = rayZMax + 100; + for (vec2 P = P0; + ((P.x * stepDir) <= end) && (stepCount < maxSteps) && + ((rayZMax < sceneZMax - zThickness) || (rayZMin > sceneZMax)) && + (sceneZMax != 0); + P += dP, Q.z += dQ.z, k += dk, ++stepCount) { + + rayZMin = prevZMaxEstimate; + rayZMax = (dQ.z * 0.5 + Q.z) / (dk * 0.5 + k); + prevZMaxEstimate = rayZMax; + if (rayZMin > rayZMax) { + float t = rayZMin; rayZMin = rayZMax; rayZMax = t; + } + + hitPixel = permute ? P.yx : P; + hitPixel.y = screen_res.y - hitPixel.y; + // You may need hitPixel.y = screen_res.y - hitPixel.y; here if your vertical axis + // is different than ours in screen space + sceneZMax = texelFetch(depthMap, ivec2(hitPixel)).r; + } + + // Advance Q based on the number of steps + Q.xy += dQ.xy * stepCount; + hitPoint = Q * (1.0 / k); + return (rayZMax >= sceneZMax - zThickness) && (rayZMin < sceneZMax); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index 4134220306..5dc219702d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -23,8 +23,8 @@ * $/LicenseInfo$ */ -uniform sampler2DRect normalMap; -uniform sampler2DRect depthMap; +uniform sampler2D normalMap; +uniform sampler2D depthMap; uniform sampler2DShadow shadowMap0; uniform sampler2DShadow shadowMap1; uniform sampler2DShadow shadowMap2; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 4b34e55efd..152402907b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -34,11 +34,11 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect normalMap; -uniform sampler2DRect lightMap; -uniform sampler2DRect depthMap; +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; +uniform sampler2D normalMap; +uniform sampler2D lightMap; +uniform sampler2D depthMap; uniform samplerCube environmentMap; uniform sampler2D lightFunc; @@ -58,6 +58,7 @@ uniform vec2 screen_res; vec3 getNorm(vec2 pos_screen); vec4 getPositionWithDepth(vec2 pos_screen, float depth); +float getDepth(vec2 pos_screen); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); float getAmbientClamp(); @@ -76,9 +77,9 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); void main() { vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; + float depth = getDepth(tc); vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2DRect(normalMap, tc); + vec4 norm = texture2D(normalMap, tc); float envIntensity = norm.z; norm.xyz = getNorm(tc); @@ -87,12 +88,12 @@ void main() float light_gamma = 1.0/1.3; da = pow(da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); + vec4 diffuse = texture2D(diffuseRect, tc); //convert to gamma space diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec4 spec = texture2D(specularRect, vary_fragcoord.xy); vec3 color = vec3(0); float bloom = 0.0; { diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 8891315e15..23ad332db4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -22,8 +22,6 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - -uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; @@ -36,10 +34,10 @@ VARYING vec2 vary_fragcoord; void main() { //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec4 pos = vec4(position.xyz, 1.0); gl_Position = pos; // appease OSX GLSL compiler/linker by touching all the varyings we said we would setAtmosAttenuation(vec3(1)); setAdditiveColor(vec3(0)); - vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; + vary_fragcoord = (pos.xy*0.5+0.5); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 694b19cdfb..7f21a074bd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -36,10 +36,10 @@ out vec4 frag_color; //class 1 -- no shadows -uniform sampler2DRect diffuseRect; -uniform sampler2DRect specularRect; -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; +uniform sampler2D diffuseRect; +uniform sampler2D specularRect; +uniform sampler2D depthMap; +uniform sampler2D normalMap; uniform samplerCube environmentMap; uniform sampler2D noiseMap; uniform sampler2D projectionMap; @@ -137,7 +137,6 @@ void main() vec4 frag = vary_fragcoord; frag.xyz /= frag.w; frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; vec3 pos = getPosition(frag.xy).xyz; vec3 lv = trans_center.xyz-pos.xyz; @@ -148,7 +147,7 @@ void main() discard; } - vec3 norm = texture2DRect(normalMap, frag.xy).xyz; + vec3 norm = texture2D(normalMap, frag.xy).xyz; float envIntensity = norm.z; norm = getNorm(frag.xy); norm = normalize(norm); @@ -176,11 +175,11 @@ void main() lv = normalize(lv); float da = dot(norm, lv); - vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; //light shaders output linear and are gamma corrected later in postDeferredGammaCorrectF.glsl diff_tex.rgb = srgb_to_linear(diff_tex.rgb); - vec4 spec = texture2DRect(specularRect, frag.xy); + vec4 spec = texture2D(specularRect, frag.xy); float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 15f141cbe5..d9a0b6c702 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -35,7 +35,7 @@ out vec4 frag_color; //class 1 -- no shadow, SSAO only -uniform sampler2DRect normalMap; +uniform sampler2D normalMap; // Inputs VARYING vec2 vary_fragcoord; diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 473d6df8fa..9d70b9d98d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -22,8 +22,6 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - -uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; @@ -34,8 +32,8 @@ uniform vec2 screen_res; void main() { //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec4 pos = vec4(position.xyz, 1.0); gl_Position = pos; - vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; + vary_fragcoord = (pos.xy * 0.5 + 0.5); } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 36563982ba..4e535f7e18 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -33,7 +33,7 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseMap; +uniform sampler2D diffuseMap; uniform float minLuminance; uniform float maxExtractAlpha; uniform vec3 lumWeights; @@ -44,7 +44,7 @@ VARYING vec2 vary_texcoord0; void main() { - vec4 col = texture2DRect(diffuseMap, vary_texcoord0.xy); + vec4 col = texture2D(diffuseMap, vary_texcoord0.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 ) ); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index 1396dc6973..db0662ad89 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -32,7 +32,7 @@ VARYING vec2 vary_texcoord0; void main() { - gl_Position = modelview_projection_matrix * vec4(position, 1.0); + gl_Position = vec4(position, 1.0); - vary_texcoord0.xy = texcoord0; + vary_texcoord0.xy = position.xy * 0.5 + 0.5; } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index cdb2281578..ea66e8271b 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -37,7 +37,7 @@ VARYING vec4 vary_texcoord3; void main() { - gl_Position = modelview_projection_matrix * vec4(position, 1.0); + gl_Position = vec4(position, 1.0); vary_texcoord0.xy = texcoord0 + glowDelta*(-3.5); vary_texcoord1.xy = texcoord0 + glowDelta*(-2.5); diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl index cff8d9d50f..99662097bb 100644 --- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl @@ -33,7 +33,7 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect depthMap; +uniform sampler2D depthMap; VARYING vec2 tc0; VARYING vec2 tc1; @@ -48,22 +48,22 @@ VARYING vec2 tc8; void main() { vec4 depth1 = - vec4(texture2DRect(depthMap, tc0).r, - texture2DRect(depthMap, tc1).r, - texture2DRect(depthMap, tc2).r, - texture2DRect(depthMap, tc3).r); + vec4(texture2D(depthMap, tc0).r, + texture2D(depthMap, tc1).r, + texture2D(depthMap, tc2).r, + texture2D(depthMap, tc3).r); vec4 depth2 = - vec4(texture2DRect(depthMap, tc4).r, - texture2DRect(depthMap, tc5).r, - texture2DRect(depthMap, tc6).r, - texture2DRect(depthMap, tc7).r); + vec4(texture2D(depthMap, tc4).r, + texture2D(depthMap, tc5).r, + texture2D(depthMap, tc6).r, + texture2D(depthMap, tc7).r); depth1 = min(depth1, depth2); float depth = min(depth1.x, depth1.y); depth = min(depth, depth1.z); depth = min(depth, depth1.w); - depth = min(depth, texture2DRect(depthMap, tc8).r); + depth = min(depth, texture2D(depthMap, tc8).r); gl_FragDepth = depth; } diff --git a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl index 71d80911d6..e104377037 100644 --- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthV.glsl @@ -45,7 +45,7 @@ void main() { gl_Position = vec4(position, 1.0); - vec2 tc = (position.xy*0.5+0.5)*screen_res; + vec2 tc = (position.xy*0.5+0.5); tc0 = tc+vec2(-delta.x,-delta.y); tc1 = tc+vec2(0,-delta.y); tc2 = tc+vec2(delta.x,-delta.y); diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl index b5bbbb5c73..0b4680767a 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl @@ -34,7 +34,7 @@ out vec4 frag_color; #endif uniform sampler2D glowMap; -uniform sampler2DRect screenMap; +uniform sampler2D screenMap; VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord1; @@ -42,5 +42,5 @@ VARYING vec2 vary_texcoord1; void main() { frag_color = texture2D(glowMap, vary_texcoord0.xy) + - texture2DRect(screenMap, vary_texcoord1.xy); + texture2D(screenMap, vary_texcoord1.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl index a9e7ea1de8..6a4c2ca623 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl @@ -33,14 +33,14 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect diffuseRect; +uniform sampler2D diffuseRect; uniform vec2 screen_res; VARYING vec2 vary_tc; void main() { - vec3 col = texture2DRect(diffuseRect, vary_tc*screen_res).rgb; + vec3 col = texture2D(diffuseRect, vary_tc).rgb; frag_color = 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 index 058f3b1b82..48aab1ce21 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl @@ -23,7 +23,6 @@ * $/LicenseInfo$ */ -uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; @@ -31,7 +30,7 @@ VARYING vec2 vary_tc; void main() { - vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0); + vec4 pos = 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 f7970b7f78..e08284f762 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl @@ -34,7 +34,7 @@ VARYING vec2 vary_texcoord1; void main() { - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_Position = vec4(position.xyz, 1.0); vary_texcoord0 = texcoord0; vary_texcoord1 = texcoord1; } diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl index 839e10ce5e..858052281b 100644 --- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl @@ -36,6 +36,7 @@ VARYING vec3 vary_dir; //uniform float roughness; uniform float mipLevel; +uniform int u_width; // ============================================================================================================= // Parts of this file are (c) 2018 Sascha Willems @@ -124,7 +125,7 @@ vec4 prefilterEnvMap(vec3 R) vec3 V = R; vec4 color = vec4(0.0); float totalWeight = 0.0; - float envMapDim = 128.0; + float envMapDim = u_width; int numSamples = 4; float numMips = 6.0; diff --git a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl index f0d579f85e..a9c28b2974 100644 --- a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl @@ -35,8 +35,8 @@ out vec4 frag_color; // NOTE screenMap should always be texture channel 0 and // depthmap should always be channel 1 -uniform sampler2DRect diffuseRect; -uniform sampler2DRect depthMap; +uniform sampler2D diffuseRect; +uniform sampler2D depthMap; uniform float resScale; uniform float znear; @@ -76,26 +76,25 @@ void main() for (int i = 0; i < 9; ++i) { - color += texture2DRect(screenMap, vary_texcoord0.xy+tc[i]).rgb * w[i]; - //color += texture2DRect(screenMap, vary_texcoord0.xy+tc[i]*2.0).rgb * w[i]*0.5; + color += texture2D(screenMap, vary_texcoord0.xy+tc[i]).rgb * w[i]; + //color += texture2D(screenMap, vary_texcoord0.xy+tc[i]*2.0).rgb * w[i]*0.5; } //color /= wsum; frag_color = vec4(color, 1.0); #else - vec2 depth_tc = vary_texcoord0.xy * resScale; - float depth = texture(depthMap, depth_tc).r; + float depth = texture(depthMap, vary_texcoord0.xy).r; float dist = linearDepth(depth, znear, zfar); // convert linear depth to distance vec3 v; - v.xy = depth_tc / 256.0 * 2.0 - 1.0; + v.xy = vary_texcoord0.xy / 512.0 * 2.0 - 1.0; v.z = 1.0; v = normalize(v); dist /= v.z; - vec3 col = texture2DRect(diffuseRect, vary_texcoord0.xy).rgb; + vec3 col = texture2D(diffuseRect, vary_texcoord0.xy).rgb; frag_color = vec4(col, dist/256.0); #endif } diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl index 7614075cfd..bf6c1b355c 100644 --- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl @@ -33,12 +33,12 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif -uniform sampler2DRect screenMap; +uniform sampler2D screenMap; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; void main() { - frag_color = texture2DRect(screenMap, vary_texcoord0.xy) * vertex_color; + frag_color = texture2D(screenMap, vary_texcoord0.xy) * vertex_color; } -- cgit v1.2.3