Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by George111111111 · Jun 25, 2021 at 05:29 PM · compute shaderray-casting

GPU Ray tracing: "kernel at index(0) is invalid"

I have been following this tutorial/blog thing: http://three-eyed-games.com/2018/05/03/gpu-ray-tracing-in-unity-part-1/

I'm stuck on the 'reflections' section, I think I have coded (more like 'copied', let's be realistic) everything that I need to, but when I press play, I get:
.

"RayTracingShader.compute: Kernel at index (0) is invalid UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)"
.

There's more, but here's what I don't understand: Why does it say the kernel is invalid?

Why does it say Dispatch(int32, int32, int32, int32) where the actual dispatch looks like: "RayTracingShader.Dispatch(0, threadGroupsX, threadGroupsY, 1);"

Have I just left something out and didn't notice?
.

I'm just starting to learn how to use computes shaders and I don't really understand it, any help would be greatly appreciated.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image George111111111 · Jul 02, 2021 at 07:29 PM 0
Share

I found the problem, I had done nothing wrong, I just missed ONE SEMICOLON!

This hurts a lot.

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ThisLove · Jul 04, 2021 at 12:10 AM

Not sure if you tried this.

But first look at the Compute Shader in the Unity Editor and it may have a list of problems.

I had this same problem following the same blog and my fix was that unlike C#, in HLSL functions need to be made before you call them, and my Sphere() function was put after my Trace() function which called it. Hope this might have anyone with this issue.

P.S. Make sure you're not using a URP(Universal Pipe Rendering) Project and if all else false sometimes just copying your asset folder to a new project works(this little trick has fixed the majority of my bugs in Unity).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Plumiferox · Jul 23, 2021 at 02:24 PM

Disable this checkbox "projectSetting/editor/shaderCompilation/cachingPreprocessor"

That will fix the problem.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RendergonPolygons · Feb 23 at 01:37 PM 0
Share

Disabling cachingPreprocessor didn't work for me, I restarted Unity. Also my functions are before the kernel. Rather selected the shader in the editor and said it had errors in the inspector On Unity 2020.3.28

avatar image
0

Answer by lgarczyn · Mar 08 at 10:22 AM

This error happens most often when there is a compile error in the target kernel (usually the first one at index 0, since most compute shaders only have one kernel).

Sadly Unity appears to only report these compile errors once, and they might get cleared in the console. There should be a list of error in the inspector when selecting the shader. You can also try modifying the shader and get the error logged again, or try to fix it through guessing and luck.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ThinhHB · Mar 31 at 03:24 PM

I face the same issue, I tried this and it worked for me:

  • Exit unity

  • Goto library folder and delete "ScriptableAssemblies" and "ShaderCache" folder

  • Reopen Unity to let it rebuild above 2 folders

Hope it will help

alt text


image-2022-03-31-222159211.png (5.3 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

124 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Compute Shader and mipmaps auto-generation 0 Answers

How do you see the results of compute shaders in the debugger? 1 Answer

Pass ComputeBuffer to another ComputeShader 0 Answers

Use compute shader to convert RenderTexture to Vector4 array 1 Answer

Graphics.CopyTexture copies wrong mip on Windows 10 build 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges