2

i use HLSL for shaders in unity games and i need to print some values and the HLSL dont have console or something like console ,because it is run from unity compute shaders.

so How i can print the Values in HLSL.

4
  • You can't actually print from shaders, but you can definitly use debuggers. Commented May 31, 2022 at 12:15
  • "so How i can print the Values in HLSL" - quite simply you can't. Remember a shader runs for all pixels at the best of times so even if you could your console would fill up pretty quick. Generally people make a funky shader to diagnose shaders where particular colours imply certain states about the shader. Commented May 31, 2022 at 12:15
  • Also, the CPU doesn't have access to the internals of the GPU and this is especially the case for compute shaders (GPGPU) due to their love for all things massively parallel. Commented May 31, 2022 at 12:16
  • docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html. examples there how you can use a shader to output debug colours. See "Using mesh normals for fun and profit" Commented May 31, 2022 at 12:31

1 Answer 1

0

Use RenderDoc to debug shaders.

https://renderdoc.org/

https://docs.unity3d.com/Manual/RenderDocIntegration.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.