Jump to content
  • Advertisement
mark_braga

How to avoid Visual Studio hanging when hovering over a really large array?

Recommended Posts

I have some pre-compiled shaders in header files stored in arrays and sometimes, the cursor will hover over these arrays which means now Visual Studio has to preview the entire array. This causes the whole application to freeze. Is there a way to stop this from happening?

const BYTE d3d_byte_code[] = {........... Very large array };

When the cursor hovers over d3d_byte_code, Visual studio will freeze trying to preview the contents of the array

Share this post


Link to post
Share on other sites
Advertisement

One workaround would be to Watch the variable (as a bounded array):

"d3d_byte_code, 30" displays 30 first bytes. 

TBH I've never seen it hang like this while debugging, so start by adding the array to the watch list and see if it still lags. Hover viewing large arrays seems pointless anyway as you have to click on the lens icon to view the entire contents. Furthermore, a large byte array (especially something akin to what your array name seems to suggest) in general seems like strange thing to debug by hovering over it. So, if VS is freezing when you do, wouldn't easiest solution be to just... not hover over it? :)

Share this post


Link to post
Share on other sites
Posted (edited)

You could also add your shaders directly in your project, they will be compiled to .cso files. Then you can add a post-compiler event that copies the .cso files to your own folder, if they're found to be newer. That's what I do anyways, works great for me :)

 

Edited by vinterberg

Share this post


Link to post
Share on other sites
On 7/12/2018 at 1:45 AM, irreversible said:

One workaround would be to Watch the variable (as a bounded array):

"d3d_byte_code, 30" displays 30 first bytes. 

TBH I've never seen it hang like this while debugging, so start by adding the array to the watch list and see if it still lags. Hover viewing large arrays seems pointless anyway as you have to click on the lens icon to view the entire contents. Furthermore, a large byte array (especially something akin to what your array name seems to suggest) in general seems like strange thing to debug by hovering over it. So, if VS is freezing when you do, wouldn't easiest solution be to just... not hover over it? :)

This is not happening while debugging but while writing code. And I dont do it on purpose but my mouse goes over the array variable sometimes and VS thinks I want to view it so it starts working on showing me this big array and it never finishes

Share this post


Link to post
Share on other sites
3 hours ago, mark_braga said:

And I dont do it on purpose but my mouse goes over the array variable sometimes and VS thinks I want to view it so it starts working on showing me this big array and it never finishes

Where same it show a whole array contents? I am using  VS 2017 with default preview options. For C++ it shows array definition only, but not a contents for similar arrays  (somesing like "statc const unsigned ArrayName [Array Sze]" )on both definition with hidden (rolled  up) initalization and reference points.And , as i am remember, previous versons (at least 2013 and 2015) has do same.

Share this post


Link to post
Share on other sites
8 hours ago, mark_braga said:

This is not happening while debugging but while writing code. And I dont do it on purpose but my mouse goes over the array variable sometimes and VS thinks I want to view it so it starts working on showing me this big array and it never finishes

Have you tried something as primitive as cleaning your project (eg rebuilding the intellisense database) or renaming the variable?

Share this post


Link to post
Share on other sites

 

On 8/1/2018 at 11:52 AM, Fulcrum.013 said:

Where same it show a whole array contents? I am using  VS 2017 with default preview options. For C++ it shows array definition only, but not a contents for similar arrays

I have only seen VS display them for global compile time constant arrays, which if the OP tried to embed the compiled shader in a C/C++ file I assume it is. Not sure why it doesn't for any other array.

A "solution", would be to put something anywhere in the array that VS can't determine, or just hide it behind a layer of indirection (e.g. put it in a ".cpp" then use extern). But I think its better not to try an embed such things directly as C/C++ code.

On 7/12/2018 at 12:14 PM, vinterberg said:

You could also add your shaders directly in your project, they will be compiled to .cso files. Then you can add a post-compiler event that copies the .cso files to your own folder, if they're found to be newer. That's what I do anyways, works great for me :)

 

If the default location is not suitable (generally next to the exe, using "$(OutDir)%(Filename).cso") you can change it in HLSL Compiler -> Output Files, no need to have a post-build step.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!