Skip to content

Commit fd8760b

Browse files
Fixing invalid shader bytecode errors for OpenGL ES and Metal. (#10041)
- Fixing error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #1 of opcode #29 (counts are 1-based). Expected int or uint. (on gles) - Removing hard to read IF step macro. - Bumping the sentinel.
1 parent fae0401 commit fd8760b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ver: 1
1+
ver: 2

Assets/MRTK/StandardAssets/Shaders/MixedRealityStandard.shader

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ Shader "Mixed Reality Toolkit/Standard"
184184
#pragma shader_feature _ENVIRONMENT_COLORING
185185
#pragma shader_feature _IGNORE_Z_SCALE
186186

187-
#define IF(a, b, c) lerp(b, c, step((fixed) (a), 0.0));
188-
189187
#include "UnityCG.cginc"
190188
#include "UnityUI.cginc"
191189
#include "UnityStandardConfig.cginc"
@@ -473,7 +471,7 @@ Shader "Mixed Reality Toolkit/Standard"
473471
#endif
474472

475473
#if defined(_ROUND_CORNERS) || defined(_BORDER_LIGHT)
476-
fixed _EdgeSmoothingValue;
474+
float _EdgeSmoothingValue;
477475
#endif
478476

479477
#if defined(_INNER_GLOW)
@@ -530,7 +528,7 @@ Shader "Mixed Reality Toolkit/Standard"
530528
{
531529
float proximityLightDistance = dot(proximityLight.xyz - worldPosition, worldNormal);
532530
#if defined(_PROXIMITY_LIGHT_TWO_SIDED)
533-
worldNormal = IF(proximityLightDistance < 0.0, -worldNormal, worldNormal);
531+
worldNormal = proximityLightDistance < 0.0 ? -worldNormal : worldNormal;
534532
proximityLightDistance = abs(proximityLightDistance);
535533
#endif
536534
float normalizedProximityLightDistance = saturate(proximityLightDistance * proximityLightParams.y);
@@ -556,12 +554,12 @@ Shader "Mixed Reality Toolkit/Standard"
556554
return length(max(abs(position) - cornerCircleDistance, 0.0)) - cornerCircleRadius;
557555
}
558556

559-
inline fixed RoundCornersSmooth(float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
557+
inline float RoundCornersSmooth(float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
560558
{
561559
return smoothstep(1.0, 0.0, PointVsRoundedBox(position, cornerCircleDistance, cornerCircleRadius) / _EdgeSmoothingValue);
562560
}
563561

564-
inline fixed RoundCorners(float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
562+
inline float RoundCorners(float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
565563
{
566564
#if defined(_TRANSPARENT)
567565
return RoundCornersSmooth(position, cornerCircleDistance, cornerCircleRadius);
@@ -723,8 +721,8 @@ Shader "Mixed Reality Toolkit/Standard"
723721

724722
#if defined(_BORDER_LIGHT)
725723
float scaleRatio = min(o.scale.x, o.scale.y) / max(o.scale.x, o.scale.y);
726-
o.uv.z = IF(o.scale.x > o.scale.y, 1.0 - (borderWidth * scaleRatio), 1.0 - borderWidth);
727-
o.uv.w = IF(o.scale.x > o.scale.y, 1.0 - borderWidth, 1.0 - (borderWidth * scaleRatio));
724+
o.uv.z = o.scale.x > o.scale.y ? 1.0 - (borderWidth * scaleRatio) : 1.0 - borderWidth;
725+
o.uv.w = o.scale.x > o.scale.y ? 1.0 - borderWidth : 1.0 - (borderWidth * scaleRatio);
728726
#endif
729727
#elif defined(_UV)
730728
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
@@ -860,7 +858,7 @@ Shader "Mixed Reality Toolkit/Standard"
860858
#endif
861859
#if defined(_CLIPPING_BORDER)
862860
fixed3 primitiveBorderColor = lerp(_ClippingBorderColor, fixed3(0.0, 0.0, 0.0), primitiveDistance / _ClippingBorderWidth);
863-
albedo.rgb += primitiveBorderColor * IF((primitiveDistance < _ClippingBorderWidth), 1.0, 0.0);
861+
albedo.rgb += primitiveBorderColor * (primitiveDistance < _ClippingBorderWidth ? 1.0 : 0.0);
864862
#endif
865863
#endif
866864

0 commit comments

Comments
 (0)