Search Issue Tracker

Fixed in 2018.2.X

Votes

0

Found in

2017.1.0p1

Issue ID

936971

Regression

No

[graphics, patch] SV_CullDistance in Shaders isn't supported on Direct3D9, OpenGLCore, OpenGLES3

Graphics - General

-

When changing graphics API to Direct3D9, OpenGLCore or OpenGLES3, shaders with SV_CullDistance won't compile and throw Error.

Steps to reproduce:
1. Open user's attached project (129886_glcore.zip)
2. Change Graphics API (in Player Settings) to Direct3D9, OpenGLCore or OpenGLES3

Result: the shader throws compiler issues and the sphere turns magenta.
Errors in the Console:
GLSL compilation failed:
ERROR: 0:23: 'vs_SV_CullDistance0' : undeclared identifier
ERROR: 0:23: 'x' : field selection requires structure, vector, or matrix on left hand side

GLSL compilation failed:
ERROR: 0:26: 'vs_SV_CullDistance0' : undeclared identifier
ERROR: 0:26: 'x' : field selection requires structure, vector, or matrix on left hand side

GLSL compilation failed:
ERROR: 0:27: 'vs_SV_CullDistance0' : undeclared identifier
ERROR: 0:27: 'x' : field selection requires structure, vector, or matrix on left hand side

GLSL compilation failed:
ERROR: 0:28: 'vs_SV_CullDistance0' : undeclared identifier
ERROR: 0:28: 'x' : field selection requires structure, vector, or matrix on left hand side

Shader error in 'Unlit/NewUnlitShader': invalid vs_3_0 output semantic 'SV_CullDistance' at line 33 (on d3d9)

Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA

Reproduced with: 2017.3.0a2, 2017.2.0b5, 2017.1.0p2, 5.6.3f1, 5.5.2p4.

Test results with different graphics APIs:
Direct3D9 - broken
Direct3D11 - works as expected
Direct3D12 (Experimental) - works when changing from Direct3D11 or OpenGLES2 , doesn't work when changing from anything else
Vulkan (Experimental) - works when changing from Direct3D11 or OpenGLES2 , doesn't work when changing from anything else
OpenGLCore - broken
OpenGLES2 - works as expected
OpenGLES3- broken

Comments (1)

  1. gattusoarthur

    Mar 07, 2022 11:16

    All SV_ semantics are only supported in Direct3D 10 or Higher. It looks like the OpenGL equivalent, gl_ClipDistance is available for OpenGL 3.0 or OpenGLES 3.2, but that probably doesn't help. gl_CullDistance isn't exposed until OpenGL 4.5!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.