List
MaxstAR/FeaturePoint compile error: SV_VertexID type must be a scalar uint
Posted Date: 2019-02-19 15:17     Edited Date: 2019-02-21 23:14     Writer: inactive

Getting below shader compile error when trying to create an Android build of the Sample scene in Unity using the Unity SDK (4.0.4). The sample scenes run fine on my development environment (macbook)..

Shader error in 'MaxstAR/FeaturePoint': Input signature parameter SV_VertexID (1-based Entry 2) type must be a scalar uint. at line 43 (on gles)

Compiling Vertex program
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING

 

Please provide your development details as below;

1. SDK Version:

Unity 4.0.4 (MAXSTARSDK_Unity_4.0.4.unityPackage)


2. Development Environment: (eg. Unity-Android, Unity-iOS, Native Android, Native iOS)

Unity-Android (developing/building on Unity on macOS 10.14.3

Unity version 2018.3.6f1 <Metal>


3. Tracker/Scanner:

ImageTracker


4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise):

Free


5. Target Device(Optional):

Target device; Samsung Tab S2 (but the build fails on the macbook before install to the target device is initiated).

Development device; Macbook Pro Retina 15-inch Mid 2014, 16 GB DDR2, 2.8Ghz Intel Core i7


We can assist better if you attach screenshots of issues.


 

Posted Date: 2019-02-20 5:44     Edited Date: 2019-02-20 5:44     Writer: inactive

I have an identical problem. It builds when pressing the build button, but fails with the above error when using build and run. Do note it does have the shader error, but it does not stop the build process.

 

#Edit:

@kalle.halvarsson's solution worked
 Just add #pragma target 3.5

Posted Date: 2019-02-20 11:12     Edited Date: 2019-02-20 11:12     Writer: inactive

The problem is that the SV_VertexID semantic requires shader model 3.5 or higher. Just add #pragma target 3.5 along with the other pragmas in the shader and it will work fine. 

Posted Date: 2019-02-20 11:18     Edited Date: 2019-02-20 11:18     Writer: inactive

@ldc.drake thanks for the hint. Yes I noticed the same, I've been able to fix the "build and run" method by slightly modifying the FeaturePoint shader for GLES targets. I'm probably not gonna use the FeaturePoints material so I didn't test the results, but at least I'm not getting errors anymore.

 

What i did is replace this line;

v2f vert (appdata v, uint vid : SV_VertexID)

 

With the following;

#if SHADER_API_GLES // SHADER_API_GLES3? SHADER_API_MOBILE?
v2f vert (appdata v/*, uint vid : SV_VertexID*/)
#else
v2f vert (appdata v, uint vid : SV_VertexID)
#endif

I was actually expecting new errors, because it removes the vid parameters which is still being referenced in the vert function, but I'm not getting any errors right now, which is all I can be bothered to care about at this point.

Posted Date: 2019-02-20 11:22     Edited Date: 2019-02-20 11:22     Writer: inactive

@kalle.halversson you just beat me to it, with a better solution as well [thumb up].

Posted Date: 2019-02-20 12:00     Edited Date: 2019-02-20 12:00     Writer: inactive

My solution was to replace 

v2f vert (appdata v, uint vid : SV_VertexID)

with this:

v2f vert (appdata v, unsigned int vid : SV_VertexID)

and no more errors.

 

 

Posted Date: 2019-02-21 23:14     Edited Date: 2019-02-21 23:14     Writer: kscho

Thanks for your kind answers.

We are greatly encouraged by your answers.

We will return your favor with a better product.

 

John,

MAXST Support Team