Jump to content

  • Log In with Google      Sign In   
  • Create Account


What does the HLSL printf function do?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 BenS1   Members   -  Reputation: 320

Like
0Likes
Like

Posted 19 November 2012 - 08:05 AM

I see from the MSDN HLSL reference that there is a printf function in HLSL:

http://msdn.microsoft.com/en-gb/library/windows/desktop/ff728755(v=vs.85).aspx

However the description of "Submits a custom shader message to the information queue." doesn't really explain what it does. What is the Information Queue.

It also includes the remark "This operation does nothing on devices that do not support it.".

So, what does it do (On devices that do support it)?

Obviously it can't output a message for every invocation as pixel shaders are exeuted millions of times a second (Typically).

I thought maybe it outputs something but only when stepping through the code in a debugger, so I tried that...

Compiling a shader with a printf in the code succeeds and it runs fine (But with the printf not doing anything obvious), but if I try to debug it (In Visual Studio 2012) the debugger crashes immediately (i.e. long before it ever actually gets to execute the printf line).

Any idea? Just curious.

Thanks
Ben

Sponsor:

#2 Radikalizm   Crossbones+   -  Reputation: 2776

Like
2Likes
Like

Posted 19 November 2012 - 08:43 AM

I assume this is the information queue they're talking about: http://msdn.microsof...f476538(v=VS.85).aspx

I believe I've also read some time ago that the printf function in HLSL does not work on hardware devices, only ref devices. Not sure about this though, I should really look it up.

Edited by MJP, 19 November 2012 - 01:55 PM.

I gets all your texture budgets!


#3 BenS1   Members   -  Reputation: 320

Like
0Likes
Like

Posted 19 November 2012 - 08:59 AM

Thanks Radikalizm, (Note the link is slightly broken, but if you manually add the "(.aspx" onto the end then it works)

Hmmmm, somehow I'd completely missed that section of the MSDN documentation despite using the DX11 documentation on there loads.

Thanks
Ben

#4 Radikalizm   Crossbones+   -  Reputation: 2776

Like
0Likes
Like

Posted 19 November 2012 - 09:04 AM

Thanks Radikalizm, (Note the link is slightly broken, but if you manually add the "(.aspx" onto the end then it works)

Hmmmm, somehow I'd completely missed that section of the MSDN documentation despite using the DX11 documentation on there loads.

Thanks
Ben


I noticed the broken link, the forum software must've automatically shortened the link
For some strange reason it won't allow me to edit my post though

I gets all your texture budgets!


#5 MJP   Moderators   -  Reputation: 10281

Like
2Likes
Like

Posted 19 November 2012 - 02:02 PM

I think I sorta fixed the link, but something is still messed up with the text.

Anyway AFAIK nobody actually implements printf in HLSL except for the REF device.

#6 BenS1   Members   -  Reputation: 320

Like
0Likes
Like

Posted 19 November 2012 - 03:59 PM

Thanks Matt,

What annoys me is that the HLSL documentation doesn't clearly state that. There are other functions in HLSL that it doesn't seem to be clear on too, such as the 'noise' function that isn't actually a HLSL function at all but rather part of the Effects Framework as far as I could tell (As the ability to fill a texture from a function is part of the Effects framework).

Thanks again
Ben




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS