From d3fc05e99fafc21a294e86fe6b76006c4fd8f658 Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 3 Aug 2015 11:18:08 -0700 Subject: [PATCH] FIxed a few shaders varyings, problem identified on MAC to be solved --- libraries/gpu/src/gpu/DrawColoredTexture.slf | 6 ++-- .../gpu/DrawTexcoordRectTransformUnitQuad.slv | 28 +++++++++---------- libraries/gpu/src/gpu/DrawTexture.slf | 6 ++-- libraries/gpu/src/gpu/DrawTextureOpaque.slf | 6 ++-- .../gpu/src/gpu/DrawTransformUnitQuad.slv | 28 +++++++++---------- .../gpu/DrawViewportQuadTransformTexcoord.slv | 4 +-- .../src/simple_textured_emisive.slf | 4 +-- .../render-utils/src/standardDrawTexture.slf | 14 +++++----- .../src/standardTransformPNTC.slv | 16 +++++------ 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/libraries/gpu/src/gpu/DrawColoredTexture.slf b/libraries/gpu/src/gpu/DrawColoredTexture.slf index 5460cf56eb..2a7f6aae36 100755 --- a/libraries/gpu/src/gpu/DrawColoredTexture.slf +++ b/libraries/gpu/src/gpu/DrawColoredTexture.slf @@ -11,13 +11,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; uniform vec4 color; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = texture(colorMap, varTexcoord) * color; + outFragColor = texture(colorMap, varTexCoord0) * color; } diff --git a/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv b/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv index e0ca81cb61..c9cc9e9dfa 100755 --- a/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv +++ b/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv @@ -13,27 +13,27 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include gpu/Transform.slh@> - +<@include gpu/Transform.slh@> + <$declareStandardTransform()$> uniform vec4 texcoordRect; -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { - const vec4 UNIT_QUAD[4] = vec4[4]( - vec4(-1.0, -1.0, 0.0, 1.0), - vec4(1.0, -1.0, 0.0, 1.0), - vec4(-1.0, 1.0, 0.0, 1.0), + const vec4 UNIT_QUAD[4] = vec4[4]( + vec4(-1.0, -1.0, 0.0, 1.0), + vec4(1.0, -1.0, 0.0, 1.0), + vec4(-1.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0) ); vec4 pos = UNIT_QUAD[gl_VertexID]; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, pos, gl_Position)$> - - varTexcoord = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy; + + // standard transform + TransformCamera cam = getTransformCamera(); + TransformObject obj = getTransformObject(); + <$transformModelToClipPos(cam, obj, pos, gl_Position)$> + + varTexCoord0 = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy; } diff --git a/libraries/gpu/src/gpu/DrawTexture.slf b/libraries/gpu/src/gpu/DrawTexture.slf index cfa18abc27..64389f02b3 100755 --- a/libraries/gpu/src/gpu/DrawTexture.slf +++ b/libraries/gpu/src/gpu/DrawTexture.slf @@ -11,12 +11,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = texture(colorMap, varTexcoord); + outFragColor = texture(colorMap, varTexCoord0); } diff --git a/libraries/gpu/src/gpu/DrawTextureOpaque.slf b/libraries/gpu/src/gpu/DrawTextureOpaque.slf index b6539e7de2..14d2072ff3 100755 --- a/libraries/gpu/src/gpu/DrawTextureOpaque.slf +++ b/libraries/gpu/src/gpu/DrawTextureOpaque.slf @@ -12,12 +12,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = vec4(texture(colorMap, varTexcoord).xyz, 1.0); + outFragColor = vec4(texture(colorMap, varTexCoord0).xyz, 1.0); } diff --git a/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv b/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv index 24e0cc25f3..f55abf1089 100755 --- a/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv +++ b/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv @@ -12,25 +12,25 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include gpu/Transform.slh@> - +<@include gpu/Transform.slh@> + <$declareStandardTransform()$> -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { - const vec4 UNIT_QUAD[4] = vec4[4]( - vec4(-1.0, -1.0, 0.0, 1.0), - vec4(1.0, -1.0, 0.0, 1.0), - vec4(-1.0, 1.0, 0.0, 1.0), + const vec4 UNIT_QUAD[4] = vec4[4]( + vec4(-1.0, -1.0, 0.0, 1.0), + vec4(1.0, -1.0, 0.0, 1.0), + vec4(-1.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0) ); vec4 pos = UNIT_QUAD[gl_VertexID]; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, pos, gl_Position)$> - - varTexcoord = (pos.xy + 1) * 0.5; + + // standard transform + TransformCamera cam = getTransformCamera(); + TransformObject obj = getTransformObject(); + <$transformModelToClipPos(cam, obj, pos, gl_Position)$> + + varTexCoord0 = (pos.xy + 1) * 0.5; } diff --git a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv index 81af3ffaf8..1f9bc13700 100755 --- a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv +++ b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv @@ -16,7 +16,7 @@ <$declareStandardTransform()$> -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { const vec4 UNIT_QUAD[4] = vec4[4]( @@ -34,5 +34,5 @@ void main(void) { <$transformModelToWorldPos(obj, tc, tc)$> gl_Position = pos; - varTexcoord = tc.xy; + varTexCoord0 = tc.xy; } diff --git a/libraries/render-utils/src/simple_textured_emisive.slf b/libraries/render-utils/src/simple_textured_emisive.slf index dd0df6ba8b..96119e98f0 100644 --- a/libraries/render-utils/src/simple_textured_emisive.slf +++ b/libraries/render-utils/src/simple_textured_emisive.slf @@ -19,8 +19,8 @@ uniform sampler2D originalTexture; // the interpolated normal in vec3 _normal; -in vec4 _texCoord0; -in vec4 _color; +in vec3 _color; +in vec2 _texCoord0; void main(void) { vec4 texel = texture(originalTexture, _texCoord0.st); diff --git a/libraries/render-utils/src/standardDrawTexture.slf b/libraries/render-utils/src/standardDrawTexture.slf index f3492c2959..b79b560556 100644 --- a/libraries/render-utils/src/standardDrawTexture.slf +++ b/libraries/render-utils/src/standardDrawTexture.slf @@ -14,18 +14,18 @@ // the texture uniform sampler2D colorMap; -in vec3 _position; -in vec3 _normal; -in vec2 _texCoord0; -in vec4 _color; +in vec3 varPosition; +in vec3 varNormal; +in vec2 varTexCoord0; +in vec4 varColor; -out vec4 _fragColor; +out vec4 outFragColor; void main(void) { - vec4 color = texture(colorMap, _texCoord0); + vec4 color = texture(colorMap, varTexCoord0); // FIXME CORE this isn't working //_fragColor = color * _color; //_fragColor = vec4(color.rgb, color.a * _color.a); //_fragColor = vec4(color.rgb * _color.rgb, color.a); - _fragColor = color; + outFragColor = color; } diff --git a/libraries/render-utils/src/standardTransformPNTC.slv b/libraries/render-utils/src/standardTransformPNTC.slv index d3429a1603..340dfd9c8e 100644 --- a/libraries/render-utils/src/standardTransformPNTC.slv +++ b/libraries/render-utils/src/standardTransformPNTC.slv @@ -18,19 +18,19 @@ <$declareStandardTransform()$> -out vec3 _position; -out vec3 _normal; -out vec2 _texCoord0; -out vec4 _color; +out vec3 varPosition; +out vec3 varNormal; +out vec2 varTexCoord0; +out vec4 varColor; void main(void) { - _texCoord0 = inTexCoord0.st; - _color = inColor; + varTexCoord0 = inTexCoord0.st; + varColor = inColor; // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> - <$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal)$> - _position = inPosition.xyz; + <$transformModelToEyeDir(cam, obj, inNormal.xyz, varNormal)$> + varPosition = inPosition.xyz; } \ No newline at end of file