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.

kareem alkoul
  • 739
  • 6
  • 13
  • You can't actually *print* from shaders, but you can definitly use debuggers. – limserhane May 31 '22 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. –  May 31 '22 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. –  May 31 '22 at 12:16
  • https://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"_ –  May 31 '22 at 12:31

1 Answers1

0

Use RenderDoc to debug shaders.

https://renderdoc.org/

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

viruseg
  • 105
  • 6