Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by TehWardy · Feb 08, 2016 at 10:38 PM · debuggingcompute shader

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

I'm trying to write some particularly complex functionality on the gpu that would be really good if I could at least see the raw data but I have no idea how.

Initially i thought my code was broken which led me to post this on stack exchange ...

http://gamedev.stackexchange.com/questions/116323/how-do-i-build-a-3d-array-result-set-from-a-compute-shader-in-unity

... I now think its possible that unity has some sort of wierd bug that prevents me looking at the result of populating a 3d array from a compute shader result.

The code in this example isn't complex so there's no reason why it shouldn't behave just like debugging any other cpu code as all I want to do is put some values in to the buffer on the gpu then download and view them by putting a breakpoint in after my buffer.GetData(cpuArray) call.

Does anyone know if there's a work around or something for this?

It's worth noting that in the edit where I generate a 3,3,3 array of voxels where all but the center one are "empty" (-1 values) and the center is full (1 value) the array in the debugger tells me all elements are 0 values (apparently not populated) but the cpu meshing code is then able to generate the correct cube mesh from it after (not included in the question).

So what must I do to inspect arrays populated from the GPU?

I have tried the following with 0 success ...

  • Normal VS debugging (breapoint look at value / add to watch window to see value)

  • Load solution in to MonoDev and repeat the VS procedure

  • Debug.Log(values)

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by npatch · Feb 09, 2016 at 07:13 AM

GPU space isn't visible by the common debugger in VS. To view data in GPU mem you have to launch some kind of Graphics Debugger. There is a way to do that but just for DX11 shaders for now: DebuggingD3D11ShadersWithVS.

It requires the Graphics Debugger in VS2015.

Now, I haven't checked Compute Shaders out in the graphics debugger but it's the only place, you might get to see gpu mem. I've successfully debugged fragment shaders though.

On other solutions, you might want to try RenderDoc by Baldur Karlsson who works at Unity.

Comment
Add comment · Show 2 · 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 TehWardy · Feb 09, 2016 at 09:22 AM 0
Share

So even if i take the gpu generated results and put them in to a cpu based array I still can't read that array in the debugger?

To be clear: I'm not trying to directly read from the gpu's ram in the debugger only the downloaded result of a GetData() call on a buffer.

avatar image TehWardy · Feb 09, 2016 at 09:36 AM 0
Share

I also just found this: http://answers.unity3d.com/questions/890356/debugging-tools-for-unity-compute-shaders.html which goes to this: http://forum.unity3d.com/threads/debugging-shaders-in-visual-studio.322186/ ... much more detailed on working with debugging code on the GPU directly ... surely I don't need all this to view the contents of an array in c# after the gpu code has run and the results been downloaded back in to c# though?

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

34 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

Related Questions

Debugging Tools for Unity Compute Shaders 2 Answers

Inputhandling is giving different results for left and right (arrows, ctrl's , shifts) but my code seems fine 3 Answers

How to debug a shader? 2 Answers

Debugging - Scale Collectible 0 Answers

Android project debugging.. 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